Last active
March 15, 2019 17:07
-
-
Save pas256/7104312 to your computer and use it in GitHub Desktop.
CloudFormation template generated by troposphere.
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
{ | |
"Outputs": { | |
"InstanceAccess": { | |
"Description": "Command to use to SSH to instance", | |
"Value": { | |
"Fn::Join": [ | |
"", | |
[ | |
"ssh -i ", | |
{ | |
"Ref": "KeyPair" | |
}, | |
" ubuntu@", | |
{ | |
"Fn::GetAtt": [ | |
"MyInstance", | |
"PublicDnsName" | |
] | |
} | |
] | |
] | |
} | |
} | |
}, | |
"Parameters": { | |
"KeyPair": { | |
"Description": "The name of the keypair to use for SSH access", | |
"Type": "String" | |
} | |
}, | |
"Resources": { | |
"MyInstance": { | |
"Properties": { | |
"ImageId": "ami-ef277b86", | |
"InstanceType": "t1.micro", | |
"KeyName": { | |
"Ref": "KeyPair" | |
}, | |
"SecurityGroups": [ | |
{ | |
"Ref": "MySecurityGroup" | |
} | |
] | |
}, | |
"Type": "AWS::EC2::Instance" | |
}, | |
"MySecurityGroup": { | |
"Properties": { | |
"GroupDescription": "Allow access to MyInstance", | |
"SecurityGroupIngress": [ | |
{ | |
"CidrIp": "0.0.0.0/0", | |
"FromPort": 22, | |
"IpProtocol": "tcp", | |
"ToPort": 22 | |
} | |
] | |
}, | |
"Type": "AWS::EC2::SecurityGroup" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original script and blog post available at:
http://answersforaws.com/blog/2013/10/cloudformation-templates-with-troposphere/