Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lists out instances that have been user shutdown. Display's Instance ID, Shutdown Date, Contact & Name tags.
aws ec2 describe-instances --region us-west-2 --output text --filters Name=state-reason-code,Values=Client.UserInitiatedShutdown --query 'sort_by(Reservations[*].Instances[], &StateTransitionReason)[*].[InstanceId,`,`, StateTransitionReason,`,`, [Tags[?Key==`Name`].Value] [0][0],`,`, [Tags[?Key==`Contact`].Value] [0][0] ]' > shutdown_instances.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment