Saravanan G
Saravanan G

Reputation: 581

AWS CLI command: Timestamp format to view the EC2 instances created on a given date

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

Answers (1)

Frederic Henri
Frederic Henri

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

Related Questions