aws ec2 describe-network-interfaces --filters "Name=subnet-id,Values=subnet-3221874a" --query 'NetworkInterfaces[*].PrivateIpAddress'
例如:
aws ec2 describe-network-interfaces --filters "Name=subnet-id,Values=subnet-3221874a" --query 'NetworkInterfaces[*].PrivateIpAddress' --region us-west-2 | jq
[
"172.31.16.173",
"172.31.28.181",
"172.31.21.46",
"172.31.31.114",
"172.31.17.211"
]
aws ec2 describe-subnets \
--filters "Name=vpc-id,Values=vpc-acfeabd4" --region us-west-2
返回结果中有个AvailableIpAddressCount字段: