Skip to content

Commit d45bf08

Browse files
authored
feat(batch): add ECS_AL2023 (#30928)
### Issue # (if applicable) None. ### Reason for this change Because, currently AWS Batch support Amazon Linux 2023, However, we can't use Amazon Linux 2023 for `ManagedEc2EcsComputeEnvironment`. https://docs.aws.amazon.com/batch/latest/APIReference/API_Ec2Configuration.html ### Description of changes Add the `EcsMachineImageType.ECS_AL2023`. ### Description of how you validated changes I could deploy ComputeEnvironment via integ-tests. Also, when I deploy with invalid ImageType, then I got the following error message. ``` Resource handler returned message: "Error executing request, Exception : Inva lid imageType in ComputeResources.ec2Configuration ``` ### Other We may should set `EcsMachineImageType.ECS_AL2023` as default under a feature flag. ### 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 7eae4d1 commit d45bf08

File tree

11 files changed

+394
-12
lines changed

11 files changed

+394
-12
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-batch/test/integ.managed-compute-environment.js.snapshot/BatchManagedComputeEnvironmentTestDefaultTestDeployAssertD4528F80.assets.json

+1-1
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-batch/test/integ.managed-compute-environment.js.snapshot/batch-stack.assets.json

+3-3
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-batch/test/integ.managed-compute-environment.js.snapshot/batch-stack.template.json

+102
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,108 @@
11181118
"Type": "managed",
11191119
"UpdatePolicy": {}
11201120
}
1121+
},
1122+
"ECSAL2023SecurityGroup7AE4A1D4": {
1123+
"Type": "AWS::EC2::SecurityGroup",
1124+
"Properties": {
1125+
"GroupDescription": "batch-stack/ECS_AL2023/SecurityGroup",
1126+
"SecurityGroupEgress": [
1127+
{
1128+
"CidrIp": "0.0.0.0/0",
1129+
"Description": "Allow all outbound traffic by default",
1130+
"IpProtocol": "-1"
1131+
}
1132+
],
1133+
"VpcId": {
1134+
"Ref": "vpcA2121C38"
1135+
}
1136+
}
1137+
},
1138+
"ECSAL2023InstanceProfileRoleEBA7FF23": {
1139+
"Type": "AWS::IAM::Role",
1140+
"Properties": {
1141+
"AssumeRolePolicyDocument": {
1142+
"Statement": [
1143+
{
1144+
"Action": "sts:AssumeRole",
1145+
"Effect": "Allow",
1146+
"Principal": {
1147+
"Service": "ec2.amazonaws.com"
1148+
}
1149+
}
1150+
],
1151+
"Version": "2012-10-17"
1152+
},
1153+
"ManagedPolicyArns": [
1154+
{
1155+
"Fn::Join": [
1156+
"",
1157+
[
1158+
"arn:",
1159+
{
1160+
"Ref": "AWS::Partition"
1161+
},
1162+
":iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
1163+
]
1164+
]
1165+
}
1166+
]
1167+
}
1168+
},
1169+
"ECSAL2023InstanceProfile14B35A51": {
1170+
"Type": "AWS::IAM::InstanceProfile",
1171+
"Properties": {
1172+
"Roles": [
1173+
{
1174+
"Ref": "ECSAL2023InstanceProfileRoleEBA7FF23"
1175+
}
1176+
]
1177+
}
1178+
},
1179+
"ECSAL20239DA0188B": {
1180+
"Type": "AWS::Batch::ComputeEnvironment",
1181+
"Properties": {
1182+
"ComputeResources": {
1183+
"AllocationStrategy": "BEST_FIT_PROGRESSIVE",
1184+
"Ec2Configuration": [
1185+
{
1186+
"ImageType": "ECS_AL2023"
1187+
}
1188+
],
1189+
"InstanceRole": {
1190+
"Fn::GetAtt": [
1191+
"ECSAL2023InstanceProfile14B35A51",
1192+
"Arn"
1193+
]
1194+
},
1195+
"InstanceTypes": [
1196+
"optimal"
1197+
],
1198+
"MaxvCpus": 256,
1199+
"MinvCpus": 0,
1200+
"SecurityGroupIds": [
1201+
{
1202+
"Fn::GetAtt": [
1203+
"ECSAL2023SecurityGroup7AE4A1D4",
1204+
"GroupId"
1205+
]
1206+
}
1207+
],
1208+
"Subnets": [
1209+
{
1210+
"Ref": "vpcPrivateSubnet1Subnet934893E8"
1211+
},
1212+
{
1213+
"Ref": "vpcPrivateSubnet2Subnet7031C2BA"
1214+
}
1215+
],
1216+
"Type": "EC2"
1217+
},
1218+
"ReplaceComputeEnvironment": false,
1219+
"State": "ENABLED",
1220+
"Type": "managed",
1221+
"UpdatePolicy": {}
1222+
}
11211223
}
11221224
},
11231225
"Parameters": {

packages/@aws-cdk-testing/framework-integ/test/aws-batch/test/integ.managed-compute-environment.js.snapshot/cdk.out

+1-1
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-batch/test/integ.managed-compute-environment.js.snapshot/integ.json

+1-1
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-batch/test/integ.managed-compute-environment.js.snapshot/manifest.json

+28-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)