Reputation: 581
We are about the automate the deletion of EC2 instances using AWS CLI. Planning to filter the instances created on a given date.
Came across the below CLI commands to view and terminate the instances
describe-instances
- to get the list of instances created on the given date range
terminate-instances
- to terminate the instances returned from "describe-instance" command
Just wanted to know, What is format of time-stamp value, to be given in the "Launchtime" filter value?
Upvotes: 2
Views: 3350
Reputation: 53713
per the doc http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeInstances.html
launch-time
The time when the instance was launched (for example, 2010-08-07T11:54:42.000Z).Type: DateTime
so the following should work
aws ec2 describe-instances --filters launch-time=2010-08-07T11:54:42.000Z
Upvotes: 5