Skip to content

Commit c8d62f3

Browse files
authored
fix(autoscaling): add an option to run validation when migrating to launch template (#34832)
This patch add an option to run validation when migrating to launch template, which checks if UpdatePolicy is specified. ### Issue # (if applicable) Closes #34283. ### Reason for this change To make migration to Launch Template safer. ### Description of changes This change introduces an option flag to check whether or not UpdatePolicy is specified. As enforcing UpdatePolicy, existing EC2 instances based on Launch Configuration are terminated, and new EC2 instances based on Launch Template are launched, which always references IAM instance profile defined by Launch Template. ### Describe any new or updated permissions being added N/A ### Description of how you validated changes Added an unit test and integration test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ba61463 commit c8d62f3

File tree

9 files changed

+540
-1784
lines changed

9 files changed

+540
-1784
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.assets.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.template.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,47 @@
11031103
"IgnoreUnmodifiedGroupSizeProperties": true
11041104
}
11051105
}
1106+
},
1107+
"AsgFromMigrationToLTASGDEC25774": {
1108+
"Type": "AWS::AutoScaling::AutoScalingGroup",
1109+
"Properties": {
1110+
"LaunchTemplate": {
1111+
"LaunchTemplateId": {
1112+
"Ref": "MainLT4FC09097"
1113+
},
1114+
"Version": {
1115+
"Fn::GetAtt": [
1116+
"MainLT4FC09097",
1117+
"LatestVersionNumber"
1118+
]
1119+
}
1120+
},
1121+
"MaxSize": "1",
1122+
"MinSize": "1",
1123+
"VPCZoneIdentifier": [
1124+
{
1125+
"Ref": "VPCPrivateSubnet1Subnet8BCA10E0"
1126+
},
1127+
{
1128+
"Ref": "VPCPrivateSubnet2SubnetCFCDAA7A"
1129+
}
1130+
]
1131+
},
1132+
"UpdatePolicy": {
1133+
"AutoScalingRollingUpdate": {
1134+
"SuspendProcesses": [
1135+
"HealthCheck",
1136+
"ReplaceUnhealthy",
1137+
"AZRebalance",
1138+
"AlarmNotification",
1139+
"ScheduledActions",
1140+
"InstanceRefresh"
1141+
]
1142+
},
1143+
"AutoScalingScheduledAction": {
1144+
"IgnoreUnmodifiedGroupSizeProperties": true
1145+
}
1146+
}
11061147
}
11071148
},
11081149
"Parameters": {

packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/cdk.out

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/integ.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)