by arkadiyt

arkadiyt /aws_public_ips

Fetch all public IP addresses tied to your AWS account. Works with IPv4/IPv6, Classic/VPC networking...

467 Stars 53 Forks Last release: 11 months ago (1.0.7) MIT License 34 Commits 8 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

awspublicips Gem TravisCI Coverage Status License

Table of Contents

What's it for

awspublicips 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 flavors):

  • 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).

Quick start

Install the gem and run it: ``` $ gem install awspublicips

Uses default ~/.aws/credentials

$ awspublicips 2600:9000:2039:ba00:1a:cd27:1440:93a1 2600:9000:2039:6e00:1a:cd27:1440:93a1

With a custom profile

$ AWSPROFILE=production awspublic_ips ```

The gem can also be run from Docker: ``` $ docker pull arkadiyt/awspublicips

For credentials, ensure the appropriate environment variables are defined in the host environment:


CLI reference

$ aws_public_ips --help
Usage: aws_public_ips [options]
    -s, --services ,,    List of AWS services to check. Available services: apigateway,cloudfront,ec2,elasticsearch,elb,elbv2,lightsail,rds,redshift. Defaults to all.
    -f, --format             Set output format. Available formats: json,prettyjson,text. Defaults to text.
    -v, --[no-]verbose               Enable debug/trace output
        --version                    Print version
    -h, --help                       Show this help message


For authentication awspublicips uses the default aws-sdk-ruby configuration, meaning that the following are checked in order: 1. Environment variables: -

2. Shared credentials files: -
3. 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:

  "Version": "2012-10-17",
  "Statement": [
      "Effect": "Allow",
      "Action": [
      "Resource": "*"


Please see This project follows semantic versioning.


Please see

Getting in touch

Feel free to tweet or direct message me: @arkadiyt

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.