Skip to content

Instantly share code, notes, and snippets.

@namuan
Last active August 26, 2018 18:08
Show Gist options
  • Save namuan/60292c61b8c7a72c7f5f513200c0e860 to your computer and use it in GitHub Desktop.
Save namuan/60292c61b8c7a72c7f5f513200c0e860 to your computer and use it in GitHub Desktop.
[AWS: Get Nat Gateway from VPCs] #aws #vpc #nat

To filter VPC Ids

aws ec2 describe-vpcs --filters Name=tag:Name,Values='dev vpc' Name=tag:ServiceName,Values=xyz --query Vpcs[].VpcId

To get public Ips for a given Vpc

aws ec2 describe-nat-gateways --filter Name=vpc-id,Values=vpc-1abc184a --query NatGateways[].NatGatewayAddresses[].PublicIp

This will give us a list of public IPs

NAT Public IPs

"X.X.X.X",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment