Created
December 1, 2016 00:26
-
-
Save SteveHoggNZ/9a58f2dba8e2205f84be33a706b052a9 to your computer and use it in GitHub Desktop.
CloudFormation / CreationPolicy / AutoScalingGroup example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Resources": { | |
"AutoScalingGroup": { | |
"Type": "AWS::AutoScaling::AutoScalingGroup", | |
"Properties": { | |
"AvailabilityZones": { "Fn::GetAZs": "" }, | |
"LaunchConfigurationName": { "Ref": "LaunchConfig" }, | |
"DesiredCapacity": "2", | |
"MinSize": "1", | |
"MaxSize": "4" | |
}, | |
"CreationPolicy": { | |
"ResourceSignal": { | |
"Count": "2", | |
"Timeout": "PT15M" | |
} | |
}, | |
"UpdatePolicy" : { | |
"AutoScalingScheduledAction" : { | |
"IgnoreUnmodifiedGroupSizeProperties" : "false" | |
}, | |
"AutoScalingRollingUpdate" : { | |
"MinInstancesInService" : "1", | |
"MaxBatchSize" : "2", | |
"PauseTime" : "PT2M", | |
"WaitOnResourceSignals" : "true" | |
} | |
} | |
}, | |
"LaunchConfig": { | |
"Type": "AWS::AutoScaling::LaunchConfiguration", | |
"Properties": { | |
"ImageId": "ami-db704cb8", | |
"InstanceType": "t2.micro", | |
"UserData": { | |
"Fn::Base64": { | |
"Fn::Join" : [ "", [ | |
"#!/bin/bash -xe\n", | |
"yum install -y aws-cfn-bootstrap\n", | |
"/opt/aws/bin/cfn-signal -e 0 --stack ", { "Ref": "AWS::StackName" }, | |
" --resource AutoScalingGroup ", | |
" --region ", { "Ref" : "AWS::Region" }, "\n" | |
] ] | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment