Skip to content

Commit

Permalink
feat(batch): add ECS_AL2023 (#30928)
Browse files Browse the repository at this point in the history
### 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*
  • Loading branch information
WinterYukky authored Aug 6, 2024
1 parent 7eae4d1 commit d45bf08
Show file tree
Hide file tree
Showing 11 changed files with 394 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,108 @@
"Type": "managed",
"UpdatePolicy": {}
}
},
"ECSAL2023SecurityGroup7AE4A1D4": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "batch-stack/ECS_AL2023/SecurityGroup",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default",
"IpProtocol": "-1"
}
],
"VpcId": {
"Ref": "vpcA2121C38"
}
}
},
"ECSAL2023InstanceProfileRoleEBA7FF23": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
]
]
}
]
}
},
"ECSAL2023InstanceProfile14B35A51": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Roles": [
{
"Ref": "ECSAL2023InstanceProfileRoleEBA7FF23"
}
]
}
},
"ECSAL20239DA0188B": {
"Type": "AWS::Batch::ComputeEnvironment",
"Properties": {
"ComputeResources": {
"AllocationStrategy": "BEST_FIT_PROGRESSIVE",
"Ec2Configuration": [
{
"ImageType": "ECS_AL2023"
}
],
"InstanceRole": {
"Fn::GetAtt": [
"ECSAL2023InstanceProfile14B35A51",
"Arn"
]
},
"InstanceTypes": [
"optimal"
],
"MaxvCpus": 256,
"MinvCpus": 0,
"SecurityGroupIds": [
{
"Fn::GetAtt": [
"ECSAL2023SecurityGroup7AE4A1D4",
"GroupId"
]
}
],
"Subnets": [
{
"Ref": "vpcPrivateSubnet1Subnet934893E8"
},
{
"Ref": "vpcPrivateSubnet2Subnet7031C2BA"
}
],
"Type": "EC2"
},
"ReplaceComputeEnvironment": false,
"State": "ENABLED",
"Type": "managed",
"UpdatePolicy": {}
}
}
},
"Parameters": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d45bf08

Please sign in to comment.