Skip to content

Instantly share code, notes, and snippets.

@horike37
Last active January 6, 2016 22:30
Show Gist options
  • Save horike37/6e52bc599710f7baaf5c to your computer and use it in GitHub Desktop.
Save horike37/6e52bc599710f7baaf5c to your computer and use it in GitHub Desktop.
VPCのネットワーク設定からシングルインスタンスのAMIMOTO立ち上げるCloudFormation テンプレート
{
"Parameters":{
"InstanceType": {
"Description": "EC2 instance type",
"Type": "String",
"Default": "t2.small",
"AllowedValues": [
"t2.small",
"t2.medium",
"t2.large",
"hi1.4xlarge",
"hs1.8xlarge",
"g2.2xlarge",
"m3.medium",
"m3.large",
"m3.xlarge",
"m3.2xlarge",
"i2.xlarge",
"i2.2xlarge",
"i2.4xlarge",
"i2.8xlarge",
"c3.large",
"c3.xlarge",
"c3.2xlarge",
"c3.4xlarge",
"c3.8xlarge",
"r3.large",
"r3.xlarge",
"r3.2xlarge",
"r3.4xlarge",
"r3.8xlarge"
]
}
},
"Mappings":{
"RegionTable":{
"us-east-1": {
"AMI": "ami-ca148fa2",
"Location": "Virginia"
},
"us-west-2": {
"AMI": "ami-83e8bfb3",
"Location": "Oregon"
},
"us-west-1": {
"AMI": "ami-950d1ed0",
"Location": "N.California"
},
"eu-west-1": {
"AMI": "ami-d275c8a5",
"Location": "EU_Ireland"
},
"ap-southeast-1": {
"AMI": "ami-bf725eed",
"Location": "Singapore"
},
"ap-southeast-2": {
"AMI": "ami-4fcfa675",
"Location": "Sydney"
},
"ap-northeast-1": {
"AMI": "ami-0e00030f",
"Location": "Tokyo"
},
"sa-east-1": {
"AMI": "ami-63de6e7e",
"Location": "Sao_Paul"
}
},
"AZs": {
"us-east-1": {
"PRI": "us-east-1d",
"SEC": "us-east-1c"
},
"us-west-2": {
"PRI": "us-west-2b",
"SEC": "us-west-2c"
},
"us-west-1": {
"PRI": "us-west-1c",
"SEC": "us-west-1b"
},
"eu-west-1": {
"PRI": "eu-west-1c",
"SEC": "eu-west-1b"
},
"ap-southeast-1": {
"PRI": "ap-southeast-1b",
"SEC": "ap-southeast-1a"
},
"ap-northeast-1": {
"PRI": "ap-northeast-1c",
"SEC": "ap-northeast-1a"
},
"ap-southeast-2": {
"PRI": "ap-southeast-2b",
"SEC": "ap-southeast-2a"
},
"sa-east-1": {
"PRI": "sa-east-1b",
"SEC": "sa-east-1a"
}
}
},
"Resources":{
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"Tags": [
{
"Key": "Name",
"Value": "panpanVPC"
},
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
}
]
}
},
"PublicSubnet": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.0.0/24",
"AvailabilityZone": {
"Fn::FindInMap": [
"AZs",
{
"Ref": "AWS::Region"
},
"PRI"
]
},
"MapPublicIpOnLaunch": "true",
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "AWS::StackName"
}
}
]
}
},
"RouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "AWS::StackName"
}
}
]
}
},
"AssociationRtToPubSub": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet"
}
}
},
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "AWS::StackName"
}
}
]
}
},
"AttachGatewayToVPC": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"InternetGatewayId": {
"Ref": "InternetGateway"
},
"VpcId": {
"Ref": "VPC"
}
}
},
"Route": {
"Type": "AWS::EC2::Route",
"Properties": {
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "InternetGateway"
},
"RouteTableId": {
"Ref": "RouteTable"
}
}
},
"SecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "This is Simple SecurityGroup made by CloudFormation",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80",
"CidrIp": "0.0.0.0/0"
}
],
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
}
],
"VpcId": {
"Ref": "VPC"
}
}
},
"PanpanServer":{
"Type":"AWS::EC2::Instance",
"Properties":{
"AvailabilityZone": {
"Fn::FindInMap": [
"AZs",
{
"Ref": "AWS::Region"
},
"PRI"
]
},
"ImageId": {
"Fn::FindInMap": [
"RegionTable",
{
"Ref": "AWS::Region"
},
"AMI"
]
},
"InstanceType":{
"Ref":"InstanceType"
},
"SubnetId": {
"Ref": "PublicSubnet"
},
"SecurityGroupIds": [
{
"Ref": "SecurityGroup"
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment