Skip to content

Instantly share code, notes, and snippets.

@pas256
Last active March 15, 2019 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pas256/7104312 to your computer and use it in GitHub Desktop.
Save pas256/7104312 to your computer and use it in GitHub Desktop.
CloudFormation template generated by troposphere.
{
"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"
}
}
}
@pas256
Copy link
Author

pas256 commented Oct 22, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment