Skip to content

Instantly share code, notes, and snippets.

@tamakiii
Last active March 18, 2019 07:30
Show Gist options
  • Save tamakiii/c5b6b932e9662722ae74c040b411df68 to your computer and use it in GitHub Desktop.
Save tamakiii/c5b6b932e9662722ae74c040b411df68 to your computer and use it in GitHub Desktop.
# ssm start-session with fzf
aws ssm start-session --target $(aws ec2 describe-instances | jq -cC '.Reservations[].Instances[] | select(.Tags[].Key == "Name") | {Name: .Tags[].Value, InstanceId: .InstanceId }' | fzf --ansi | jq -r '.InstanceId')
# get instances which have publicDnsName
aws ec2 describe-instances | jq -c '.Reservations[].Instances[] | select(.Tags[].Key == "Name") | select(.PublicDnsName != "") | select(.State.Name == "running") | {"Name": .Tags[].Value, "InstanceId": .InstanceId, "PublicDnsName": .PublicDnsName }' | fzf | jq -r '.PublicDnsName'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment