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

Is there an easy way to map AMI release versions to AMI names or IDs? #531

Closed
Nuru opened this issue Sep 1, 2020 · 2 comments
Closed

Is there an easy way to map AMI release versions to AMI names or IDs? #531

Nuru opened this issue Sep 1, 2020 · 2 comments
Labels
question Further information is requested

Comments

@Nuru
Copy link

Nuru commented Sep 1, 2020

Is there a convenient way to find the right AMI id given an EKS AMI release version? It seems there would be, except the AMIs have names like amazon-eks-node-1.16-v20200821 for the AMI release version 1.16.13-20200821 which means I have to do some string parsing and transformation. The SSM parameters have the same problem

$ aws ssm get-parameter --name   /aws/service/eks/optimized-ami/1.16/amazon-linux-2/recommended/release_version --query 'Parameter.Value' --output text
1.16.13-20200821
$ aws ssm get-parameter --name   /aws/service/eks/optimized-ami/1.16/amazon-linux-2/amazon-eks-node-1.16.13-20200821/image_id --query 'Parameter.Value' --output text

An error occurred (ParameterNotFound) when calling the GetParameter operation: 
$ aws ssm get-parameter --name   /aws/service/eks/optimized-ami/1.16/amazon-linux-2/amazon-eks-node-1.16-v20200821/image_id --query 'Parameter.Value' --output text
ami-0412dd0339679edc9

@cartermckinnon
Copy link
Member

I would just fetch the recommended parameter, which contains all the important bits:

> aws ssm get-parameter --name   /aws/service/eks/optimized-ami/1.16/amazon-linux-2/recommended
{
    "Parameter": {
        "Name": "/aws/service/eks/optimized-ami/1.16/amazon-linux-2/recommended",
        "Type": "String",
        "Value": "{\"schema_version\":\"2\",\"image_id\":\"ami-0cd14786b7816816a\",\"image_name\":\"amazon-eks-node-1.16-v20211013\",\"release_version\":\"1.16.15-20211013\"}",
        "Version": 49,
        "LastModifiedDate": "2021-10-18T15:44:05.686000-07:00",
        "ARN": "arn:aws:ssm:us-west-2::parameter/aws/service/eks/optimized-ami/1.16/amazon-linux-2/recommended",
        "DataType": "text"
    }
}

We also include the release version alongside the AMI name in our CHANGELOG + GitHub release notes.

@cartermckinnon cartermckinnon added the question Further information is requested label Nov 21, 2022
@Nuru
Copy link
Author

Nuru commented Jun 11, 2024

@cartermckinnon You seem to have missed my point. What if I don't want the latest/recommended version?

I look at https://github.com/awslabs/amazon-eks-ami/releases, and if I want, say, release version 1.29.3-20240531, I do not have an easy way to map that to an AMI ID. Ideally, it would be

$ aws ssm get-parameter --name \
/aws/service/eks/optimized-ami/1.29/amazon-linux-2023/arm64/standard/1.29.3-20240531/image_id

An error occurred (ParameterNotFound) when calling the GetParameter operation: 

by analogy to

aws ssm get-parameter --name \
/aws/service/eks/optimized-ami/1.29/amazon-linux-2023/arm64/standard/recommended/image_id

Instead, I have to go to the release notes and look up the name based on the OS, Architecture, and special features, which are already specified in the path anyway, and look it up like this:

aws ssm get-parameter --name \
/aws/service/eks/optimized-ami/1.29/amazon-linux-2023/arm64/standard/amazon-eks-node-al2023-arm64-standard-1.29-v20240531/image_id

That is kind of ridiculous and not nearly as helpful. If the parameter paths were available by release version, then I could use the same release version for all the the variants.

Note that Botterocket works the way I like:

aws ssm get-parameter --name \
/aws/service/bottlerocket/aws-k8s-1.29/x86_64/1.20.1-7c3e9198/image_id

works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants