【发布时间】:2017-03-10 12:17:24
【问题描述】:
我正在尝试运行此脚本:
from __future__ import print_function
import paramiko
import boto3
#print('Loading function')
paramiko.util.log_to_file("/tmp/Dawny.log")
# List of EC2 variables
region = 'us-east-1'
image = 'ami-<>'
keyname = '<>.pem'
ec2 = boto3.resource('ec2')
instances = ec2.create_instances(
ImageId=image, MinCount=1, MaxCount=1,
InstanceType = 't2.micro', KeyName=keyname)
instance = instances[0]
instance.wait_until_running()
instance.load()
print(instance.public_dns_name)
我在完成所有 aws 配置的服务器上运行此脚本(在 aws configure 中)
而且,当我运行它时,我得到了这个错误:
botocore.exceptions.ClientError:调用 RunInstances 操作时发生错误(AuthFailure):未授权图像: [ami-]
有什么原因吗?还有,我该如何解决?
[图片是私密的。但是,由于我在服务器上配置了boto,从技术上讲,它应该不是问题,对吧?]
【问题讨论】:
-
您的实例似乎没有您登录时使用的运行权限。您可能需要在创建实例后为其显式设置它,或者将其设置为默认策略。
标签: python amazon-web-services boto3 amazon-ami