【发布时间】:2018-12-13 21:32:33
【问题描述】:
我制作了源实例的图像,现在我必须克隆新实例,因此我在创建目标实例时硬编码了源实例的安全组名称。现在我希望它是动态的。以下是我的代码:
ec2 = boto3.resource('ec2',region_name='region')
instance = ec2.create_instances( ImageId=image, InstanceType='t2.micro', KeyName='keyName', SecurityGroups=['sgr-ssh-http-public'], MaxCount=1, MinCount=1 )
【问题讨论】:
-
您的问题到底是什么?请更具体。你都尝试了些什么?你为什么不上传你的代码?
-
@vishal.k 这里是代码 ec2 = boto3.resource('ec2',region_name='region') instance = ec2.create_instances( ImageId=image, InstanceType='t2.micro', KeyName='keyName', SecurityGroups=['sgr-ssh-http-public'], MaxCount=1, MinCount=1) "SecurityGroups=['sgr-ssh-http-public']" 我希望这是动态的
-
这不是您在 stackoverflow 中编写代码的方式。此外,您应该在问题中而不是在 cmets 中添加代码
标签: python amazon-ec2 boto3 aws-security-group