简体   繁体   中英

aws cli command for list of elastic ip address that are not in use?

我需要编写一个Shell脚本来查找任何实例未使用的Elastic ip地址列表,并且需要将免费ip关联到我新启动的实例。

You can use this aws cli to get all the elastic Ip's that are not in use.

aws ec2 describe-addresses --query "Addresses[?NetworkInterfaceId == null ].PublicIp"

If you need output in text format just append --output text to the CLI.

You can then similarly use the cli to launch a new EC2. Refer the cli https://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html on details around launching an instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM