aws_public_ips: Fetch all public IP addresses tied to your AWS account
aws_public_ips
aws_public_ips is a tool to fetch all public IP addresses (both IPv4/IPv6) associated with an AWS account.
It can be used as a library and as a CLI, and supports the following AWS services (all with both Classic & VPC flavours):
- APIGateway
- CloudFront
- EC2 (and as a result: ECS, EKS, Beanstalk, Fargate, Batch, & NAT Instances)
- ElasticSearch
- ELB (Classic ELB)
- ELBv2 (ALB/NLB)
- Lightsail
- RDS
- Redshift
If a service isn’t listed (S3, ElastiCache, etc) it’s most likely because it doesn’t have anything to support (i.e. it might not be deployable publicly, it might have all IP addresses resolve to global AWS infrastructure, etc).
Quickstart
Install the gem and run it:
Configuration
For authentication aws_public_ips uses the default aws-sdk-ruby configuration, meaning that the following are checked in order:
- Environment variables:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_REGION
- AWS_PROFILE
- Shared credentials files:
- ~/.aws/credentials
- ~/.aws/config
- Instance profile via metadata endpoint (if running on EC2, ECS, EKS, or Fargate)
For more information see the AWS SDK documentation on configuration.
IAM permissions
To find the public IPs from all AWS services, the minimal policy needed by your IAM user is:
Use
Copyright (c) 2018 Arkadiy Tetelman
Source: https://github.com/arkadiyt/