Skip to content

Instantly share code, notes, and snippets.

@mmitou
Created April 22, 2014 09:55
Show Gist options
  • Select an option

  • Save mmitou/11172535 to your computer and use it in GitHub Desktop.

Select an option

Save mmitou/11172535 to your computer and use it in GitHub Desktop.
sshでつながる
{ "AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "test",
"Parameters" : {
"KeyPairName" : {
"Type" : "String",
"Description" : "key pair name"
}
},
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "AMI" : "ami-2f726546" },
"us-west-1" : { "AMI" : "ami-84f1cfc1" },
"us-west-2" : { "AMI" : "ami-b8f69f88" },
"eu-west-1" : { "AMI" : "ami-a921dfde" },
"ap-southeast-1" : { "AMI" : "ami-787c2c2a" },
"ap-southeast-2" : { "AMI" : "ami-0bc85031" },
"ap-northeast-1" : { "AMI" : "ami-a1bec3a0" },
"sa-east-1" : { "AMI" : "ami-89de7c94" }
}
},
"Resources" : {
"testVpc" : {
"Type" : "AWS::EC2::VPC",
"Properties" : {
"CidrBlock" : "192.168.0.0/24",
"EnableDnsSupport" : "true",
"EnableDnsHostnames" : "false",
"InstanceTenancy" : "default",
"Tags" : [ { "Key": "Name", "Value" : "test" },
{ "Key": "Description", "Value" : "this is test." } ]
}
},
"testVpcSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "enable ssh access via port 22",
"SecurityGroupEgress" : [ { "IpProtocol" : "tcp", "FromPort" : "0", "ToPort" : "65535", "CidrIp" : "0.0.0.0/0" } ],
"SecurityGroupIngress" : [ { "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : "0.0.0.0/0" } ],
"VpcId" : { "Ref" : "testVpc" },
"Tags" : [ { "Key": "Name", "Value" : "test" } ]
}
},
"testInternetGateway" : {
"Type" : "AWS::EC2::InternetGateway",
"Properties" : {
"Tags" : [ { "Key" : "Name", "Value" : "test" } ]
}
},
"attachGateway" : {
"Type" : "AWS::EC2::VPCGatewayAttachment",
"Properties" : {
"VpcId" : { "Ref" : "testVpc" },
"InternetGatewayId" : { "Ref" : "testInternetGateway" }
}
},
"testRouteTable" : {
"Type" : "AWS::EC2::RouteTable",
"Properties" : {
"VpcId" : { "Ref" : "testVpc" },
"Tags" : [ { "Key": "Name", "Value" : "test" } ]
}
},
"testRoute" : {
"Type" : "AWS::EC2::Route",
"DependsOn" : "testInternetGateway",
"Properties" : {
"DestinationCidrBlock" : "0.0.0.0/0",
"GatewayId" : { "Ref" : "testInternetGateway" },
"RouteTableId" : { "Ref" : "testRouteTable" }
}
},
"testSubnet0" : {
"Type" : "AWS::EC2::Subnet",
"Properties" : {
"CidrBlock" : "192.168.0.0/24",
"Tags" : [ { "Key": "Name", "Value" : "test" } ],
"VpcId" : { "Ref" : "testVpc" }
}
},
"testSubnetRouteTableAssociation" : {
"Type" : "AWS::EC2::SubnetRouteTableAssociation",
"Properties" : {
"SubnetId" : { "Ref" : "testSubnet0" },
"RouteTableId" : { "Ref" : "testRouteTable" }
}
},
"testNetworkInterface" : {
"Type" : "AWS::EC2::NetworkInterface",
"Properties" : {
"Description" : "test eni",
"GroupSet" : [ { "Ref" : "testVpcSecurityGroup" } ],
"SubnetId" : { "Ref" : "testSubnet0" },
"Tags" : [ { "Key" : "Name", "Value" : "test" } ]
}
},
"testElasticIP" : {
"Type" : "AWS::EC2::EIP",
"Properties" : {
"Domain" : "vpc"
}
},
"testEipAssociation" : {
"Type" : "AWS::EC2::EIPAssociation",
"Properties" : {
"AllocationId" : { "Fn::GetAtt" : [ "testElasticIP", "AllocationId" ]},
"NetworkInterfaceId" : { "Ref" : "testNetworkInterface" }
}
},
"testServer0" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : { "Fn::FindInMap" : ["RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"InstanceType" : "t1.micro",
"KeyName" : { "Ref" : "KeyPairName" },
"Monitoring" : "true",
"NetworkInterfaces" : [ { "NetworkInterfaceId" : {"Ref" : "testNetworkInterface" }, "DeviceIndex" : "0" }]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment