Last active
April 5, 2016 03:55
-
-
Save ryo0301/c6635992ee45f7049fcd to your computer and use it in GitHub Desktop.
CloudFormationのロールバック時に設定ファイルも元に戻す ref: http://qiita.com/ryo0301/items/c2141d05eda63b2d2bad
This file contains 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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "CloudFormation rollback test", | |
"Parameters": { | |
"VersionId": { | |
"Type": "String" | |
} | |
}, | |
"Resources": { | |
"Group": { | |
"Type": "AWS::AutoScaling::AutoScalingGroup", | |
"CreationPolicy": { | |
"ResourceSignal": { | |
"Count": "2", | |
"Timeout": "PT10M" | |
} | |
}, | |
"UpdatePolicy": { | |
"AutoScalingRollingUpdate": { | |
"MaxBatchSize": "1", | |
"MinInstancesInService": "1", | |
"WaitOnResourceSignals": "true", | |
"PauseTime": "PT10M" | |
}, | |
"AutoScalingScheduledAction": { | |
"IgnoreUnmodifiedGroupSizeProperties": "true" | |
} | |
}, | |
"Properties": { | |
"LaunchConfigurationName": { "Ref": "LaunchConfig" }, | |
"VPCZoneIdentifier": [ | |
"subnet-XXXXXXXX" | |
], | |
"HealthCheckType": "EC2", | |
"DesiredCapacity": "2", | |
"MinSize": "2", | |
"MaxSize": "2" | |
} | |
}, | |
"LaunchConfig": { | |
"Type": "AWS::AutoScaling::LaunchConfiguration", | |
"Properties": { | |
"BlockDeviceMappings": [ | |
{ | |
"DeviceName": "/dev/xvda", | |
"Ebs": { | |
"VolumeType": "gp2", | |
"VolumeSize": "8", | |
"DeleteOnTermination": "true" | |
} | |
} | |
], | |
"IamInstanceProfile": "test", | |
"ImageId": "ami-383c1956", | |
"InstanceType": "t2.micro", | |
"InstanceMonitoring": "false", | |
"UserData": { | |
"Fn::Base64": { | |
"Fn::Join": [ | |
"", [ | |
"#!/bin/bash\n", | |
"yum update -y aws-cfn-bootstrap\n", | |
"yum install -y nginx\n", | |
"aws s3api get-object", | |
" --bucket XXXXXXX", | |
" --key nginx.conf", | |
" --version-id '", {"Ref": "VersionId"}, "'", | |
" /etc/nginx/nginx.conf\n", | |
"service nginx start\n", | |
"/opt/aws/bin/cfn-signal -e $?", | |
" --stack ", {"Ref": "AWS::StackName"}, | |
" --resource Group", | |
" --region ", {"Ref": "AWS::Region"} | |
] | |
] | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains 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
Received SUCCESS signal with UniqueId i-XXXXXXXX | |
Received SUCCESS signal with UniqueId i-XXXXXXXX |
This file contains 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
Received 1 FAILURE signal(s) out of 2. Unable to satisfy 100% MinSuccessfulInstancesPercent requirement |
This file contains 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
Received SUCCESS signal with UniqueId i-XXXXXXXX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment