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.
Given that you'll need some programmatic way of calculating "30 days ago", you're better-off doing this in a programming language, such as:
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:-
Reason why "==" is not working in the switch as it used for exact match string.
So the complete string is :-