I’m just going to drop a bunch of random AWS CLI things I’ve struggled to find. These aren’t overly complicated, I just don't know the CLI too intricately I’m now AWS-CLI’ing at a sixth grade level.
List full EC2 details with partial tag search/match
aws ec2 describe-instances --filter "Name=tag:Name,Values=*Case Sensitive Phrase*"
I can’t be bothered dealing with tags, but the below uses jq
to show InstanceId and the Name tag (ontop of all tags… takes too long to solve that part). This is handy for finding InstanceIds for SSM.
aws ec2 describe-instances --filter "Name=tag:Name,Values=Axon*" | jq -r '.Reservations[].Instances[] | [.Tags[].Value, .InstanceId]'
Only show running EC2 Instances
Line 1 shows the ‘only show running’ filter, line 2 shows how you can add multiple filters to a command.
aws ec2 describe-instances --filter "Name=instance-state-name,Values=running"
aws ec2 describe-instances --filter "Name=tag:Name,Values=*Case Sensitive Phrase*" "Name=instance-state-name,Values=running"