【发布时间】:2022-02-23 00:59:29
【问题描述】:
我正在使用 boto3 创建一个 ec2 实例,我想打印该新实例的 IP 地址。
ec2 = boto3.resource('ec2')
# create the instance
new_instance = ec2.create_instances(
ImageId='###',
MinCount = 1,
MaxCount = 1,
InstanceType = 't2.nano',
KeyName = "key",
SecurityGroupIds = ["###"]
)
... wait until running ...
ip = new_instance[0].ipv4 # something like this
有没有办法在它运行后做这样的事情?
【问题讨论】:
标签: python amazon-web-services amazon-ec2 boto3