AWS EC2 instance list using aws-cli

See all EC2 instance list or describe the list of EC2 instance using the aws-cli command that provides the all instance information related to the specific EC2 instance in the tabular format.

AWS EC2 describe instance
aws ec2 describe-instances –region=your-region-name –query ‘Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value|[0],State.Name,PrivateIpAddress,PublicIpAddress,InstanceType,LaunchTime,PrivateDnsName,ImageId,VpcId]’

AWS EC2 describe instance in tabular format
aws ec2 describe-instances –region=your-region-name –query ‘Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value|[0],State.Name,PrivateIpAddress,PublicIpAddress,InstanceType,LaunchTime,PrivateDnsName,ImageId,VpcId]’ –output table

AWS EC2 describe stopped instance in tabular format
aws ec2 describe-instances –region=your-region-name –filters “Name=instance-state-name,Values=stopped” –query ‘Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value|[0],State.Name]’ –output table

Leave a Reply

Your email address will not be published. Required fields are marked *