If i need to get all the Linux instances tag names, ids, ami, keys...:
aws ec2 describe-instances \
--filters "Name=platform-details,Values=Linux/UNIX,Ubuntu Pro" \
--query 'Reservations[*].Instances[*].[InstanceId, State.Name, PlatformDetails, ImageId, KeyName, Tags[?Key==`Name`].Value | [0]]' \
--output table
To get the Linux EC2 operational system details, for update purposes:
aws ssm describe-instance-information \
--query 'InstanceInformationList[*].[InstanceId, PlatformName, PlatformVersion, PlatformType]' \
--output table
If you need to do a fine check, to see an instance that doesn't appear in the previous search, it can happen sometimes:
aws ssm describe-instance-information \
--filters "Key=InstanceIds,Values=<**Instance ID**>" \
--query 'InstanceInformationList[0].[InstanceId, PlatformName, PlatformVersion]' \
--output table
The documentation is:
For Windows EC2, checkout the documentation, some minor changes can be applie to the cli commands and get the same results.
Top comments (0)