2020-06-27 00:09:13 +08:00
|
|
|
Description: >-
|
|
|
|
Cloud Formation template for Acrolinx instance.
|
|
|
|
Parameters:
|
|
|
|
InputInstanceType:
|
|
|
|
Description: EC2 Instance Type
|
|
|
|
Default: t3a.medium
|
|
|
|
Type: String
|
|
|
|
InputSubdomain:
|
|
|
|
Description: Subdomain of acrolinx instance
|
|
|
|
Type: String
|
|
|
|
Default: rstest
|
|
|
|
InputTimezone:
|
|
|
|
Description: Timezone of instance
|
|
|
|
Type: String
|
|
|
|
Default: UTC
|
2020-06-29 17:07:53 +08:00
|
|
|
InputSubnet:
|
|
|
|
Description: Subnet of instance
|
|
|
|
Type: String
|
|
|
|
Default: "Enter an unused CIDR"
|
2020-06-27 16:02:31 +08:00
|
|
|
|
2020-06-27 15:10:06 +08:00
|
|
|
Mappings:
|
2020-06-27 16:02:31 +08:00
|
|
|
RegionMap:
|
|
|
|
us-west-2:
|
|
|
|
VpcId: vpc-7155ca14
|
|
|
|
ImageId: ami-0a8d75344fec6c412
|
|
|
|
SshKey: ACROLINX-OREGON
|
|
|
|
SecGroups: ["sg-0c8c5cf4dca2147ee","sg-d444e4b2","sg-0b93187b","sg-859d16f5"]
|
|
|
|
eu-west-1:
|
|
|
|
VpcId: vpc-55a5a930
|
|
|
|
ImageId: ami-0385d2ff9f9c3706d
|
|
|
|
SshKey: ACROLINX-IRELAND
|
|
|
|
SecGroups: ["sg-07ffa804cbff134ed","sg-5217ce2e","sg-620ad31e","sg-aa0ed7d6"]
|
2020-06-27 00:09:13 +08:00
|
|
|
|
|
|
|
Resources:
|
|
|
|
InstanceSubnet:
|
|
|
|
Type: AWS::EC2::Subnet
|
|
|
|
Properties:
|
2020-06-27 15:10:06 +08:00
|
|
|
VpcId: !FindInMap [RegionMap, !Ref "AWS::Region", VpcId]
|
2020-06-29 17:07:53 +08:00
|
|
|
CidrBlock: !Ref InputSubnet
|
2020-06-27 16:02:31 +08:00
|
|
|
|
|
|
|
Ec2Instance:
|
2020-06-27 00:09:13 +08:00
|
|
|
Type: AWS::EC2::Instance
|
|
|
|
Properties:
|
2020-06-29 17:07:53 +08:00
|
|
|
IamInstanceProfile: AmazonSSMRoleForInstancesQuickSetup
|
2020-06-27 15:10:06 +08:00
|
|
|
KeyName: !FindInMap [RegionMap, !Ref "AWS::Region", SshKey]
|
2020-06-27 00:09:13 +08:00
|
|
|
InstanceType: !Ref InputInstanceType
|
2020-06-27 15:10:06 +08:00
|
|
|
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", ImageId]
|
2020-06-27 00:09:13 +08:00
|
|
|
SubnetId: !Ref InstanceSubnet
|
2020-06-27 15:10:06 +08:00
|
|
|
SecurityGroupIds: !FindInMap [RegionMap, !Ref "AWS::Region", SecGroups]
|
2020-06-27 16:02:31 +08:00
|
|
|
Tags:
|
2020-06-27 00:09:13 +08:00
|
|
|
- Key: "Name"
|
|
|
|
Value: !Join ['', [!Ref 'InputSubdomain', ".acrolinx.cloud"]]
|
|
|
|
- Key: "TZ"
|
|
|
|
Value: !Ref InputTimezone
|
2020-06-29 17:07:53 +08:00
|
|
|
- Key: "SSM-Enabled"
|
|
|
|
Value: "yes"
|
2020-06-27 00:09:13 +08:00
|
|
|
UserData:
|
|
|
|
'Fn::Base64': !Sub |
|
2020-06-27 16:02:31 +08:00
|
|
|
#!/bin/bash -ex
|
|
|
|
yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
|
|
|
|
systemctl enable amazon-ssm-agent
|
2020-06-27 00:09:13 +08:00
|
|
|
|
|
|
|
Ec2EIP:
|
|
|
|
Type: AWS::EC2::EIP
|
2020-06-27 16:02:31 +08:00
|
|
|
Properties:
|
2020-06-27 00:09:13 +08:00
|
|
|
Domain: vpc
|
|
|
|
InstanceId: !Ref Ec2Instance
|
|
|
|
|
|
|
|
PublicDnsRecord:
|
|
|
|
Type: AWS::Route53::RecordSet
|
|
|
|
Properties:
|
|
|
|
HostedZoneName: "acrolinx.cloud."
|
|
|
|
Comment: DNS name for my instance.
|
|
|
|
Name: !Join ['', [!Ref 'InputSubdomain', ".acrolinx.cloud"]]
|
|
|
|
Type: A
|
|
|
|
TTL: '900'
|
2020-06-27 16:02:31 +08:00
|
|
|
ResourceRecords:
|
2020-06-27 00:09:13 +08:00
|
|
|
- !Ref Ec2EIP
|
|
|
|
|
|
|
|
OriginDnsRecord:
|
|
|
|
Type: AWS::Route53::RecordSet
|
|
|
|
Properties:
|
|
|
|
HostedZoneName: "acrolinx.cloud."
|
|
|
|
Comment: DNS name for my instance.
|
2020-06-27 16:02:31 +08:00
|
|
|
Name: !Join ['', ['origin-', !Ref 'InputSubdomain', ".acrolinx.cloud"]]
|
2020-06-27 00:09:13 +08:00
|
|
|
Type: A
|
|
|
|
TTL: '900'
|
2020-06-27 16:02:31 +08:00
|
|
|
ResourceRecords:
|
2020-06-27 00:09:13 +08:00
|
|
|
- !Ref Ec2EIP
|