Mor*_*ney 4 amazon-ec2 amazon-web-services amazon-iam ansible
我正在尝试使用 Ansible./ec2.py --list --refresh-cache
列出我的 AWS EC2 实例。
通过文档,我已经浏览了这个清单:
pip
和boto
~/.boto
文件,包括我从 AWS IAM 用户的访问凭证收到的aws_access_key_id
和aws_secret_access_key
ec2.py
并ec2.ini
以相同的路径,并留下两个文件不变./ec2.py --list --refresh-cache
*我的政策:
{
"Statement": [
{
"Sid": "Stmt1427001800780",
"Action": "*",
"Effect": "Allow",
"Resource": "*"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我这样做了,并希望能够列出 EC2 实例,通过ec2.py
这些实例基本上可以通过boto
,但实际上看到了Error connecting to AWS backend. You are not authorized to perform this operation
. 但是,ssh
我可以通过ssh ubuntu@[ip]
.
我真的在这里撞墙。我究竟做错了什么?
编辑:根据@EEAA 的建议添加一些新信息
当我pprint.pprint(e)
在亚马逊的回复中使用时:
EC2ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>UnauthorizedOperation</Code><Message>You are not authorized to perform this operation.</Message></Error></Errors><RequestID>b985d559-c410-4462-8b10-e0819fd81f12</RequestID></Response>
Run Code Online (Sandbox Code Playgroud)
我~/.boto
的配置如下:
[Credentials]
aws_access_key_id = removed
aws_secret_access_key = removed
Run Code Online (Sandbox Code Playgroud)
小智 7
我收到“禁止”作为对“./ec2.py --list”的响应。当不使用 RDS 并且进行了描述 RDS 资源的查询请求时,它看起来像是一个错误(这是此插件的默认设置)。只需像这样禁用 ec2.ini 中的请求:
rds = False
Run Code Online (Sandbox Code Playgroud)
小智 6
如果不使用 ElasticCache,您也必须将其设置为 False。所以取消注释
elasticache = False
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5915 次 |
最近记录: |