Skip to content

Instantly share code, notes, and snippets.

@SteveHoggNZ
Created December 2, 2016 00:02
Show Gist options
  • Save SteveHoggNZ/cd3855a329632a3c3934adb80a5a646d to your computer and use it in GitHub Desktop.
Save SteveHoggNZ/cd3855a329632a3c3934adb80a5a646d to your computer and use it in GitHub Desktop.
CloudFormation / Nested stack example
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Master template that includes nested templates",
"Parameters": {
"DeployBastion": {
"Description": "Should a bastion server be deployed?",
"Default": "No",
"Type": "String",
"AllowedValues": ["No", "Yes"]
}
},
"Resources": {
"VPCStack": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"TemplateURL": "https://s3-ap-southeast-2.amazonaws.com/<REDACTED>/<REDACTED>.json",
"TimeoutInMinutes": "5"
}
},
"BastionStack": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"TemplateURL": "https://s3-ap-southeast-2.amazonaws.com/<REDACTED>/<REDACTED>.json",
"Parameters": {
"VpcId": { "Fn::GetAtt": ["VPCStack", "Outputs.VpcId"] },
"DeployBastion": { "Ref": "DeployBastion" },
"SubnetId": { "Fn::GetAtt": ["VPCStack", "Outputs.PublicSubnetA"] }
}
}
}
}
"Outputs": {
"VpcId": {
"Value": {
"Fn::GetAtt": ["VPCStack", "Outputs.VpcId"]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment