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

ec2: latestAmazonLinux2022() does not return available parameters #26274

Closed
pahud opened this issue Jul 7, 2023 · 1 comment · Fixed by #26284
Closed

ec2: latestAmazonLinux2022() does not return available parameters #26274

pahud opened this issue Jul 7, 2023 · 1 comment · Fixed by #26284
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@pahud
Copy link
Contributor

pahud commented Jul 7, 2023

Describe the bug

ec2.MachineImage.latestAmazonLinux2022() does not return any valid Amazon Linux 2022 parameters.

Looking at its implementation, it's supposed to return parameters with al2022 prefix

export class AmazonLinux2022ImageSsmParameter extends AmazonLinuxImageSsmParameterBase {
/**
* Generates a SSM Parameter name for a specific amazon linux 2022 AMI
*
* Example values:
*
* "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-5.15-x86_64",
* "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-default-x86_64",
* "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-5.15-arm64",
* "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-5.15-x86_64",
* "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-5.15-arm64",
* "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-default-arm64",
* "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-default-x86_64",
* "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-default-arm64",
*/

But if we list all parameters with /aws/service/ami-amazon-linux-latest path, no al2022 parameters will be returned.

$ aws ssm get-parameters-by-path --path /aws/service/ami-amazon-linux-latest --query "Parameters[].Name"
[
    "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-arm64",
    "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64",
    "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-6.1-arm64",
    "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-6.1-x86_64",
    "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-arm64",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-s3",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-ebs",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-x86_64-ebs",
    "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64",
    "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-ebs",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-minimal-hvm-x86_64-s3",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-minimal-pv-x86_64-s3",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-pv-x86_64-s3",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-arm64-gp2",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-arm64-gp2",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-x86_64-gp2",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-minimal-hvm-arm64-ebs",
    "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-arm64",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-minimal-hvm-x86_64-ebs",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-minimal-pv-x86_64-ebs",
    "/aws/service/ami-amazon-linux-latest/amzn-ami-pv-x86_64-ebs",
    "/aws/service/ami-amazon-linux-latest/amzn2-ami-minimal-hvm-x86_64-ebs"
]

I guess we probably should deprecate latestAmazonLinux2022().

Expected Behavior

parameters returned from latestAmazonLinux2022() should be available.

Current Behavior

parameters not found.

Reproduction Steps

ec2.MachineImage.latestAmazonLinux2022()

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.87.0

Framework Version

No response

Node.js Version

v18.16.0

OS

mac os x

Language

Typescript

Language Version

No response

Other information

No response

@pahud pahud added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 7, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Jul 7, 2023
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jul 7, 2023
@pahud pahud changed the title ec2: latestAmazonLinux2022() does not return any al2022 images ec2: latestAmazonLinux2022() does not return available parameters Jul 7, 2023
mergify bot pushed a commit that referenced this issue Jul 10, 2023
…launch time (#26273)

Launch Template and EC2 instance support using SSM parameter to resolve the AMI ID at instance launch time(`resolve:ssm:parameter`) rather than the CFN deploy time(`CfnDynamicReference`). This PR introduces a new support for that.

- [Using SSM Parameter with Autoscaling and Launch Template](https://docs.aws.amazon.com/autoscaling/ec2/userguide/using-systems-manager-parameters.html)
- [Launch an instance using a Systems Manager parameter](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html#using-systems-manager-parameter-to-find-AMI)

Remove `latestAmazonLinux2022()` from the integ test as it does not return any valid al2022 images anymore as described in #26274

Closes #24551

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@mergify mergify bot closed this as completed in #26284 Jul 25, 2023
mergify bot pushed a commit that referenced this issue Jul 25, 2023
SSM parameter is not offering any al2022 AMIs as described in #26274. This PR marks `latestAmazonLinux2022()` as deprecated and uses `latestAmazonLinux2023()` instead. 

- [x] mark latestAmazonLinux2022 as deprecated
- [x] update the aws-ec2 README to use latestAmazonLinux2023 instead


Closes #26274 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

bmoffatt pushed a commit to bmoffatt/aws-cdk that referenced this issue Jul 29, 2023
…launch time (aws#26273)

Launch Template and EC2 instance support using SSM parameter to resolve the AMI ID at instance launch time(`resolve:ssm:parameter`) rather than the CFN deploy time(`CfnDynamicReference`). This PR introduces a new support for that.

- [Using SSM Parameter with Autoscaling and Launch Template](https://docs.aws.amazon.com/autoscaling/ec2/userguide/using-systems-manager-parameters.html)
- [Launch an instance using a Systems Manager parameter](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html#using-systems-manager-parameter-to-find-AMI)

Remove `latestAmazonLinux2022()` from the integ test as it does not return any valid al2022 images anymore as described in aws#26274

Closes aws#24551

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
bmoffatt pushed a commit to bmoffatt/aws-cdk that referenced this issue Jul 29, 2023
SSM parameter is not offering any al2022 AMIs as described in aws#26274. This PR marks `latestAmazonLinux2022()` as deprecated and uses `latestAmazonLinux2023()` instead. 

- [x] mark latestAmazonLinux2022 as deprecated
- [x] update the aws-ec2 README to use latestAmazonLinux2023 instead


Closes aws#26274 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant