Weitere ähnliche Inhalte
Ähnlich wie 現場的!オンプレとAWSの違い (20)
現場的!オンプレとAWSの違い
- 14. {
"Parameters"
:
{
"KeyName"
:
{
"Description"
:
"Name
of
an
existing
EC2
KeyPair
to
enable
SSH
access
to
the
instance",
"Type"
:
"String"
}
},
"Mappings"
:
{
"RegionMap"
:
{
"us-‐east-‐1"
:
{
"AMI"
:
"ami-‐76f0061f"
},
"us-‐west-‐1"
:
{
"AMI"
:
"ami-‐655a0a20"
},
"eu-‐west-‐1"
:
{
"AMI"
:
"ami-‐7fd4e10b"
},
"ap-‐southeast-‐1"
:
{
"AMI"
:
"ami-‐72621c20"
},
"ap-‐northeast-‐1"
:
{
"AMI"
:
"ami-‐8e08a38f"
}
}
},
"Resources"
:
{
"Ec2Instance"
:
{
"Type"
:
"AWS::EC2::Instance",
"Properties"
:
{
"KeyName"
:
{
"Ref"
:
"KeyName"
},
"ImageId"
:
{
"Fn::FindInMap"
:
[
"RegionMap",
{
"Ref"
:
"AWS::Region"
},
"AMI"
]},
"UserData"
:
{
"Fn::Base64"
:
"80"
}
}
}
}
}
- 15.
"Outputs":
{
"InstallURL":
{
"Value":
{
"Fn::Join":
[
"",
[
"http://",
{
"Fn::GetAtt":
[
"ElasticLoadBalancer",
"DNSName"
]
},
"/wp-‐admin/install.php"
]
]
},
"Description"
:
"Installation
URL
of
the
WordPress
website"
},
"WebsiteURL":
{
"Value":
{
"Fn::Join":
[
"",
[
"http://",
{
"Fn::GetAtt":
[
"ElasticLoadBalancer",
"DNSName"
]
}
]
]
}
}
}
- 23. テンプレートのチェーン
"Resources":
{
"CloudFormationStackVPCBasic"
:
{
"Type":
"AWS::CloudFormation::Stack",
"Properties":
{
"TemplateURL":
"https://s3-‐ap-‐northeast-‐1.amazonaws.com/template.suz-‐lab.com/template/suz-‐lab_vpc-‐
basic-‐0.0.1.json",
"TimeoutInMinutes":
"60"
}
},
"CloudFormationStackOnDemandNAT"
:
{
"Type":
"AWS::CloudFormation::Stack",
"Properties":
{
"TemplateURL"
:
"https://s3-‐ap-‐northeast-‐1.amazonaws.com/template.suz-‐lab.com/template/suz-‐
lab_ondemand-‐nat-‐0.0.1.json",
"Parameters"
:
{
"KeyName":
{
"Ref":
"KeyName"
},
"ImageId":
{
"Ref":
"OnDemandNATImageId"
},
"InstanceType":
{
"Ref":
"OnDemandNATInstanceType"
},
"Name":
{
"Ref":
"OnDemandNATName"
},
"RouteTableId":
{
"Fn::GetAtt"
:
[
"CloudFormationStackVPCBasic",
"Outputs.RouteTableIdProtected"
]
},
"SecurityGroupId":
{
"Fn::GetAtt"
:
[
"CloudFormationStackVPCBasic",
"Outputs.SecurityGroupIdCommon"
]
},
"SubnetId":
{
"Fn::GetAtt"
:
[
"CloudFormationStackVPCBasic",
"Outputs.SubnetIdPublicVarA00"
]
},
"VpcId":
{
"Fn::GetAtt"
:
[
"CloudFormationStackVPCBasic",
"Outputs.VpcIdBasic"
]
}
}
}
}
},
親テンプレートの定義
- 24. 同一レイヤーは Auto Scaling で
"Resources":
{
"AutoScalingLaunchConfig"
:
{
"Type"
:
"AWS::AutoScaling::LaunchConfiguration",
"Properties"
:
{
"KeyName"
:
{
"Ref"
:
"KeyName"
},
"ImageId"
:
{
"Ref"
:
"ImageId"
},
"SecurityGroups"
:
{
"Ref"
:
"SecurityGroups"
},
"InstanceType"
:
{
"Ref"
:
"InstanceType"
}
}
},
"AutoScalingAutoScalingGroup"
:
{
"Type"
:
"AWS::AutoScaling::AutoScalingGroup",
"Properties"
:
{
"DesiredCapacity"
:
{
"Ref"
:
"CapacitySize"
},
"LaunchConfigurationName"
:
{
"Ref"
:
"AutoScalingLaunchConfig"
},
"MaxSize"
:
{
"Ref"
:
"CapacitySize"
},
"MinSize"
:
{
"Ref"
:
"CapacitySize"
},
"AvailabilityZones"
:
[
{
"Fn::FindInMap"
:
[
"AzMap",
{
"Ref"
:
"AWS::Region"
},
"Az1"
]
},
{
"Fn::FindInMap"
:
[
"AzMap",
{
"Ref"
:
"AWS::Region"
},
"Az2"
]
}
],
"Tags"
:
[
{
"Key"
:
"Name",
"Value"
:
{
"Ref"
:
"Name"
},
"PropagateAtLaunch"
:
true
}
]
}
}
},
Parameters