如何查找 Amazon S3 使用的 IP 地址范围?

1 分钟阅读
0

如何查找 Amazon Simple Storage Service (Amazon S3) 使用的 IP 地址范围?

解决方案

首先,下载包含所有 AWS IP 地址范围的 JSON 文件。然后,在文件中搜索字符串 "service": "S3"

在 Linux 或 macOS 计算机上,您可以使用诸如 jq 之类的工具解析 JSON 响应。例如,以下命令可解析 Amazon S3 使用的所有 IPv4 地址中的 JSON 文件:

curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.service=="S3") | .ip_prefix'

52.95.154.0/23

52.219.64.0/22

52.92.72.0/22

52.92.64.0/22

52.95.156.0/24

....

再比如,以下命令可解析特定 AWS 区域 (us-east-1) 中的 Amazon S3 使用的所有 IPv4 地址的 JSON 响应:

curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.region=="us-east-1") | select(.service=="S3") | .ip_prefix'

54.231.0.0/17

52.92.16.0/20

52.216.0.0/15

在 Windows 操作系统上,您可以使用 AWS Tools for PowerShell。以下 Get-AWSPublicIpAddressRange 命令可筛选 Amazon S3 使用的所有 IPv4 和 IPv6 地址:

Get-AWSPublicIpAddressRange -ServiceKey S3 | select IpPrefix
IpPrefix
--------
52.47.73.72/29
13.55.255.216/29
52.15.247.208/29
...
...
2a05:d07c:2000::/40
2a05:d000:8000::/40
2406:dafe:2000::/40
...

如需更多示例,请参阅筛选 JSON 文件


相关信息

AWS IP 地址范围

相关视频

AWS 官方
AWS 官方已更新 3 年前