Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GMKBabu/761c5a26853bd01c444a75101d0e349c to your computer and use it in GitHub Desktop.
Save GMKBabu/761c5a26853bd01c444a75101d0e349c 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