Kunaljain's Weblog

April 29, 2020

List ec2 instances with details like – Platform, Lifecycle, Instance Type

Filed under: AWS — Kunal Jain @ 14:45
Tags: , , ,

While gathering few data from my Instances I came across how can I list my EC2 instances with details as – Lifecycle (Spot/Normal), Platform (Linux/Windows,) Instance Type (c3, m4, m5, r5…. etc).

So ran the following command to get the desired output.

aws ec2 describe-instances –query “Reservations[*].Instances[*].{PublicIP:PublicIpAddress,Type:InstanceType,LifeCycle:InstanceLifecycle,Name:Tags[?Key==’Name’]|[0].Value,Status:State.Name,Platfrom:Platform}” –filters “Name=instance-state-name,Values=running” –output table

Output –

Note:-

For Lifecycle – None means Normal Instance type

For Platform – None means Linux Platform.

Create a free website or blog at WordPress.com.