Skip to content

Commit d6be99a

Browse files
committed
Merge pull request #4534 from helgi/aws-stack-policy
ref(aws): Ensure CloudFormation does not replace running instances on AMI changes.
2 parents 46a5ec7 + eb9e68c commit d6be99a

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

contrib/aws/provision-aws-cluster.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ aws cloudformation create-stack \
5252
--template-body "$($THIS_DIR/gen-json.py --channel $COREOS_CHANNEL --version $COREOS_VERSION)" \
5353
--stack-name $STACK_NAME \
5454
--parameters "$(<$THIS_DIR/cloudformation.json)" \
55+
--stack-policy-body "$(<$THIS_DIR/stack_policy.json)" \
5556
$EXTRA_AWS_CLI_ARGS
5657

5758
# loop until the instances are created

contrib/aws/stack_policy.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"Statement" : [
3+
{
4+
"Effect" : "Deny",
5+
"Principal" : "*",
6+
"Action" : "Update:Replace",
7+
"Resource" : "*",
8+
"Condition" : {
9+
"StringEquals" : {
10+
"ResourceType" : ["AWS::EC2::Instance"]
11+
}
12+
}
13+
},
14+
{
15+
"Effect" : "Allow",
16+
"Principal" : "*",
17+
"Action" : "Update:*",
18+
"Resource" : "*"
19+
}
20+
]
21+
}

contrib/aws/update-aws-cluster.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ aws cloudformation update-stack \
3535
--template-body "$($THIS_DIR/gen-json.py --channel $COREOS_CHANNEL --version $COREOS_VERSION)" \
3636
--stack-name $NAME \
3737
--parameters "$(<$THIS_DIR/cloudformation.json)" \
38+
--stack-policy-body "$(<$THIS_DIR/stack_policy.json)" \
3839
$EXTRA_AWS_CLI_ARGS
3940

4041
echo_green "Your Deis cluster on AWS CloudFormation has been successfully updated."

0 commit comments

Comments
 (0)