[英]How/Can I set up an instance to use an already made for AWS ec2 using python 3
使用 python 3 创建新实例时,是否可以使用已制作的密钥对 3. 我可以在此代码中插入新行吗?
#!/usr/bin/env python3
import boto3
ec2 = boto3.resource('ec2')
instance = ec2.create_instances(
ImageId='ami-0713f98de93617bb4',
MinCount=1,
MaxCount=1,
InstanceType='t2.nano')
print (instance[0].id)
像这样指定 KeyName 参数:
instance = ec2.create_instances(
ImageId='ami-0713f98de93617bb4',
MinCount=1,
MaxCount=1,
InstanceType='t2.nano',
KeyName='myKeyName')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.