-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
aws ec2 describe-snapshots: default timestamp returned is incompatible with API filters #8969
Comments
Thanks for reaching out. Linking documentation for reference: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-snapshots.html I could reproduce the behavior that you described. However, the filter worked once I changed the timestamp to UTC with .000Z at the end. (For example,
You may have been using v1 of the AWS CLI previously, as there were changes in v2 regarding timestamp processing. If you set cli_timestamp_format to |
So to confirm: I cannot take the direct value of StartTime in the JSON output from describe-snapshot (this is all with aws cli v2 in a shell script) and feed it directly into the filter "start-time"? I have to add the time zone? That seems like a UX bug. |
If using v2, then you can set
After doing that, the |
Per your advice, if I run: "aws --profile "${aws_profile}" configure set cli_timestamp_format wire" directly after authenticating, my script works as intended. I guess we can close this, but I still think it's a bit of a UX bug to have aws cli v2 unable to consume directly in subsequent filters the timestamps it produces without changing its default configuration. Thanks for your help! |
Thanks for following up here and confirming that your script is working. I think we can keep this open as it does seem if anything like a quirk that could be better documented. I'll update the title description to help with tracking going forward. |
Describe the bug
When I run:
$ aws --profile profile_name ec2 --region us-east-1 describe-snapshots --filter Name=tag:infra-build,Values=2023Z | jq '.Snapshots[].StartTime'
I get:
"2023-10-03T15:31:24.241000+00:00"
"2023-10-02T08:31:10.302000+00:00", etc.
When I then run:
aws --profile profile_name ec2 --region us-east-1 describe-snapshots --filter Name=start-time,Values="2023-10-03T15:31:24.241000+00:00"
I get:
{
"Snapshots": []
}
I'm pretty sure this used to work.
Regression Issue
Expected Behavior
If I filter describe-snapshots with --filter Name=start-time using the time listed under "StartTime", I expect to get the snapshot with that specific StartTime.
Current Behavior
If I filter describe-snapshots with --filter Name=start-time using the time listed under "StartTime", I get:
{
"Snapshots": []
}
Reproduction Steps
When I run:
$ aws --profile profile_name ec2 --region us-east-1 describe-snapshots --filter Name=tag:infra-build,Values=2023Z | jq '.Snapshots[].StartTime'
I get:
"2023-10-03T15:31:24.241000+00:00"
"2023-10-02T08:31:10.302000+00:00", etc.
When I then run:
aws --profile profile_name ec2 --region us-east-1 describe-snapshots --filter Name=start-time,Values="2023-10-03T15:31:24.241000+00:00"
I get:
{
"Snapshots": []
}
Possible Solution
No response
Additional Information/Context
No response
CLI version used
aws-cli/2.18.3 Python/3.12.6 Linux/6.1.0-25-amd64 exe/x86_64.debian.12
Environment details (OS name and version, etc.)
Linux 6.1.0-25-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.106-3 (2024-08-26) x86_64 GNU/Linux, Debian version 12.7, updated yesterday.
The text was updated successfully, but these errors were encountered: