Created
November 30, 2016 21:58
-
-
Save SteveHoggNZ/4cc9e5d60fe546ffbd73870379fb5f64 to your computer and use it in GitHub Desktop.
CloudFormation / CreationPolicy / Minimal EC2 example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Resources": { | |
"SSHServerSecurityGroup" : { | |
"Type" : "AWS::EC2::SecurityGroup", | |
"Properties" : { | |
"VpcId" : "vpc-fdcfd098", | |
"GroupDescription" : "Allow SSH access", | |
"SecurityGroupIngress" : [ | |
{"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : "<REDACTED>/32"} | |
] | |
} | |
}, | |
"MyEC2": { | |
"Type" : "AWS::EC2::Instance", | |
"Properties" : { | |
"ImageId" : "ami-db704cb8", | |
"KeyName" : "<REDACTED>", | |
"InstanceType" : "t2.micro", | |
"NetworkInterfaces" : [ { | |
"AssociatePublicIpAddress" : "true", | |
"DeviceIndex" : "0", | |
"GroupSet" : [ {"Ref" : "SSHServerSecurityGroup"} ], | |
"SubnetId" : "subnet-eccc6988" | |
} ], | |
}, | |
"CreationPolicy": { | |
"ResourceSignal": { | |
"Count": 1, | |
"Timeout": "PT10M" | |
} | |
} | |
}, | |
"MyTestSecurityGroup" : { | |
"Type" : "AWS::EC2::SecurityGroup", | |
"DependsOn" : "MyEC2", | |
"Properties" : { | |
"VpcId" : "vpc-fdcfd098", | |
"GroupDescription" : "A test security group", | |
"SecurityGroupIngress" : [ | |
{"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"} | |
] | |
} | |
} | |
}, | |
"Outputs" : { | |
"PublicIp" : { | |
"Value" : { "Fn::GetAtt" : [ "MyEC2", "PublicIp" ] }, | |
"Description" : "The instance's public IP" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment