Skip to content

Instantly share code, notes, and snippets.

@tmorioka
Created November 24, 2022 08:27
Show Gist options
  • Save tmorioka/ee48c7aeaeb16519d90210091acbd38d to your computer and use it in GitHub Desktop.
Save tmorioka/ee48c7aeaeb16519d90210091acbd38d to your computer and use it in GitHub Desktop.
lookup public ec2 ip by name
#!/bin/bash
function ec2ip () {
aws ec2 describe-instances --filters "Name=tag:Name,Values=${1}" | jq '.Reservations[].Instances[].PublicIpAddress' | perl -pe 's/"//g'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment