获取与您的 AWS 帐户绑定的所有公共 IP 地址。适用于 IPv4/IPv6、经典/VPC 网络以及所有 AWS 服务。
获取与您的 AWS 帐户绑定的所有公共 IP 地址。适用于 IPv4/IPv6、经典/VPC 网络以及所有 AWS 服务。
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 flavors):
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).
Install the gem and run it:
$ gem install aws_public_ips
# Uses default ~/.aws/credentials
$ aws_public_ips
52.84.11.13
52.84.11.83
2600:9000:2039:ba00:1a:cd27:1440:93a1
2600:9000:2039:6e00:1a:cd27:1440:93a1
# With a custom profile
$ AWS_PROFILE=production aws_public_ips
52.84.11.159The gem can also be run from Docker:
$ docker pull arkadiyt/aws_public_ips
# For credentials, ensure the appropriate environment variables are defined in the host environment:
$ docker run -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN arkadiyt/aws_public_ips$ 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 messageFor authentication aws_public_ips uses the default aws-sdk-ruby configuration, meaning that the following are checked in order:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGIONAWS_PROFILE~/.aws/credentials~/.aws/configFor more information see the AWS SDK documentation on configuration.
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": [
"apigateway:GET",
"cloudfront:ListDistributions",
"ec2:DescribeInstances",
"elasticloadbalancing:DescribeLoadBalancers",
"lightsail:GetInstances",
"lightsail:GetLoadBalancers",
"rds:DescribeDBInstances",
"redshift:DescribeClusters",
"es:ListDomainNames"
],
"Resource": "*"
}
]
}Please see CHANGELOG.md. This project follows semantic versioning.
Please see CONTRIBUTING.md.
Feel free to tweet or direct message me: @arkadiyt
暂无开放 Issues,或尚未同步最近议题。