List All EC2 EBS Snapshots Taken On A Particular Date
I am trying to list all EBS volume snapshot which is taken on a particular date so that i can automate a copy via bash script across region for better disaster recovery I have an another bash script that creates snapshots of all in use EBS volumes and delete all which is older then 30 days. I need to copy all which is taken on a previous date across an another region.
I tried many jmespath switches (which is not giving any output) some of them are as:-
$aws ec2 describe-snapshots --query 'Sanpshots[?StartTime >= `2018-06-25`]|[?StartTime <= `2018-06-27`]'
$aws ec2 describe-snapshots --query 'Sanpshots[?StartTime == `2018-06-25`]
I looked many pages but not able to find for a particular date listing. Please suggest some switches,sorting methods,links or anything. Thanks.
Answer
I Figured the JMESpath switch from doc right here. So in order to search for a particular date i applied a switch which search between two dates. for example:-
'Snapshots[?(StartTime >= `2018-06-27`) && (StartTime <= `2018-06-28`)]
Reason why "==" is not working in the switch as it used for exact match string.
So the complete string is :-
aws ec2 describe-snapshots --query 'Snapshots[?(StartTime >= `2018-06-27`) && (StartTime <= `2018-06-28`)].{ID:SnapshotId,ST:StartTime}' --output text --region $regionname
Related Questions
- → AWS SDK with Lumen
- → Using AWS Certificate with a parked domain for a shopify store
- → laravel or AWS don't detect my https
- → S3 putObject callback not returning expected objects
- → Amazon S3 image hosting with Shopify
- → Redirection to https not working using AWS Elastic Beanstalk
- → Shopify app showing request blocked by an extension
- → AWS Iam commands, Working correct in terminal and not working in Laravel/PHP AWS SDK
- → Violates the following Content Security Policy directive: *** in Shopify
- → AWS S3 cannot delete objects in bucket via PHP SDK
- → Laravel s3 multiple buckets
- → AWS IoT private.pem.key doesn't exist
- → Supervise queue in laravel 5.1