-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Imagebuilder command cannot receive all images #8980
Comments
Thanks for reaching out. Here is a link to the documentation for that command: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/imagebuilder/list-images.html. There is actually a limitation here with the underlying ListImages API, where it will only return up to 25 results at a time. The You can try setting the
Another option you could try using is a boto3 script like this to fetch all of the results: import boto3
list = []
client = boto3.client('imagebuilder')
response = client.list_images(filters=[
{'name': 'name', 'values': ['test-recipe']}])
list.append(response['imageVersionList'])
while 'nextToken' in response:
response = client.list_images(filters=[
{'name': 'name', 'values': ['test-recipe']}], nextToken=response['nextToken'])
list.append(response['imageVersionList'])
print(list) Upon searching internally I founder there was a previous issue related to this filtering behavior. I think the EC2 Image Builder team was planning improvements to this — I'm not sure if there are any updates on that but will try following up with them. |
Thank you for boto script. I used bash to do similar kind of task. I cannot use --by-name as image name contains some string that I need to look for and it is not exact match. I understand that issue relies with underlying API returning back 25 results. But even though I have less than 25 results on the server, filters command is not returning back all the results at the same time. I assume
Not sure if that other issue you mentioned in your comment is related with the same thing that I mentioned above, but just putting it here for later knowledge. |
We heard back from the service team who noted that there are two issues here: their service doesn't auto-paginate in the CLI due to an explicit exclusion in the AWS CLI, and their API sometimes gives empty pages due to how filtering works. They are working on addressing the second issue with empty pages, but this has not been prioritized yet. Please refer to the CHANGELOG for updates going forward and feel free to check back in the future. But since this cannot be addressed directly via the AWS CLI and must be supported by the service team, I will close this issue as not planned. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
aws imagebuilder list-images
command always returns nextToken causing it to not get all images from ec2 image builder.I found that it is getting stopped after 25 results and then it sends back nextToken no matter what option I use. So, I tried to filter it with
--query
like belowand even though I have less than 20 images with that version, it showed only 3 images in the result.
Next I tried using
--filters
option and it still returned only 3 results with nextTokenIn summary, I used all options and still cannot return my version = 2024.10.15 images in cli.
P.S. Just a suggestion – the global
--no-paginate
option could really benefit from a different name. Many people assume that using this option means pagination is disabled and that all results will be returned in one go. AlthoughRegression Issue
Expected Behavior
It should return 20 images
Current Behavior
I tried all options and still cannot return my version = 2024.10.15 images when using aws cli.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CLI version used
aws-cli/2.17.13 Python/3.11.9 Linux/5.15.153.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22
Environment details (OS name and version, etc.)
Ubuntu in wsl
The text was updated successfully, but these errors were encountered: