Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ecs): add Amazon Linux 2023 to EcsOptimizedImage #26989

Merged
merged 5 commits into from
Sep 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/aws-cdk-lib/aws-ecs/lib/amis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class EcsOptimizedAmi implements ec2.IMachineImage {
+ (this.windowsVersion ? 'ami-windows-latest/' : 'ecs/optimized-ami/')
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX ? 'amazon-linux/' : '')
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 ? 'amazon-linux-2/' : '')
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023 ? 'amazon-linux-2023/' : '')
+ (this.windowsVersion ? `Windows_Server-${this.windowsVersion}-English-Full-ECS_Optimized/` : '')
+ (this.hwType === AmiHardwareType.GPU ? 'gpu/' : '')
+ (this.hwType === AmiHardwareType.ARM ? 'arm64/' : '')
Expand Down Expand Up @@ -192,6 +193,19 @@ export interface EcsOptimizedImageOptions {
* Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM
*/
export class EcsOptimizedImage implements ec2.IMachineImage {
/**
* Construct an Amazon Linux 2023 image from the latest ECS Optimized AMI published in SSM
*
* @param hardwareType ECS-optimized AMI variant to use
*/
public static amazonLinux2023(hardwareType = AmiHardwareType.STANDARD, options: EcsOptimizedImageOptions = {}): EcsOptimizedImage {
return new EcsOptimizedImage({
generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023,
hardwareType,
cachedInContext: options.cachedInContext,
});
}

/**
* Construct an Amazon Linux 2 image from the latest ECS Optimized AMI published in SSM
*
Expand Down Expand Up @@ -253,6 +267,7 @@ export class EcsOptimizedImage implements ec2.IMachineImage {
+ (this.windowsVersion ? 'ami-windows-latest/' : 'ecs/optimized-ami/')
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX ? 'amazon-linux/' : '')
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 ? 'amazon-linux-2/' : '')
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023 ? 'amazon-linux-2023/' : '')
+ (this.windowsVersion ? `Windows_Server-${this.windowsVersion}-English-Full-ECS_Optimized/` : '')
+ (this.hwType === AmiHardwareType.GPU ? 'gpu/' : '')
+ (this.hwType === AmiHardwareType.ARM ? 'arm64/' : '')
Expand Down
Loading