AWS CLI 命令:时间戳格式以查看在给定日期创建的 EC2 实例

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

我们将使用 AWS CLI 自动删除 EC2 实例。计划筛选在给定日期创建的实例。

遇到以下用于查看和终止实例的 CLI 命令

describe-instances - 获取在给定日期范围内创建的实例列表

terminate-instances - 终止从 "describe-instance" 命令返回的实例

只是想知道,要在 "Launchtime" 过滤器值中给出的时间戳值的格式是什么?

根据文档 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

因此以下应该有效

aws ec2 describe-instances --filters launch-time=2010-08-07T11:54:42.000Z