Skip to content

Instantly share code, notes, and snippets.

@Satak
Created February 15, 2019 13:20
Show Gist options
  • Save Satak/2e9b8bd62a8ba20d44db849b7002a271 to your computer and use it in GitHub Desktop.
Save Satak/2e9b8bd62a8ba20d44db849b7002a271 to your computer and use it in GitHub Desktop.
AWS CloudFormation Template
Resources:
MyInstance:
Type: 'AWS::EC2::Instance'
Properties:
AvailabilityZone: eu-west-1a
ImageId:
Ref: ImageId
KeyName: !Ref KeyName
InstanceType:
Ref: InstanceType
SubnetId: !Ref SubnetId
SecurityGroupIds: !Ref SecurityGroupIds
Tags:
- Key: Name
Value:
Ref: InstanceName
- Key: Environment
Value:
Ref: Environment
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
VolumeType:
Ref: VolumeType
VolumeSize:
Ref: VolumeSize
Parameters:
InstanceType:
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- t2.small
- t2.medium
Description: Enter t2.micro, t2.small, or t2.medium. Default is t2.micro.
Environment:
Type: String
Default: dev
AllowedValues:
- dev
- test
- prod
Description: Tags
InstanceName:
Type: String
ImageId:
Type: String
AllowedValues:
- ami-00035f41c82244dab
- centos-7.6-plain-x86_64-181207_14-disk001-6f5e98a1-bc66-4b6a-a37d-efb4b2472f8a-ami-0372f888c4e669f49.4
SecurityGroupIds:
Type: List<AWS::EC2::SecurityGroup::Id>
KeyName:
Type: AWS::EC2::KeyPair::KeyName
SubnetId:
Type: AWS::EC2::Subnet::Id
VolumeSize:
Type: Number
MinValue: 8
MaxValue: 100
VolumeType:
Type: String
Default: gp2
AllowedValues:
- gp2
- st1
- io1
- sc1
Description: gp2 = SSD, st1 = HDD, io1 = IOPS SSD, sc1 = Cold HDD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment