我正在尝试从一个正在运行的实例绑定、上传和注册一个实例存储AMI。在调用EC2-寄存器时,我得到响应:
Client.UnauthorizedOperation: You are not authorized to perform this operation.实例在通过IAM角色授予的权限下运行。该策略使用数据对线预置:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:List*",
"s3:Put*",
"s3:Get*",
"s3:DeleteObject",
"dynamodb:DescribeTable",
"dynamodb:Scan",
"dynamodb:Query",
"dynamodb:GetItem",
"dynamodb:BatchGetItem",
"dynamodb:UpdateTable",
"rds:DescribeDBInstances",
"rds:DescribeDBSecurityGroups",
"redshift:DescribeClusters",
"redshift:DescribeClusterSecurityGroups",
"cloudwatch:PutMetricData",
"datapipeline:PollForTask",
"datapipeline:ReportTaskProgress",
"datapipeline:SetTaskStatus",
"datapipeline:PollForTask",
"datapipeline:ReportTaskRunnerHeartbeat"
],
"Resource": [
"*"
]}
]}我需要在这里添加什么来授权EC2-注册运行?..or,我是否误解了这一切是如何工作的?
发布于 2014-10-02 10:29:51
最后,答案很简单,就是在上面的JSON策略中向操作数组添加正确的字符串。我还不需要与dynamodb、rds、redshift或数据管道相关的权限,所以我删除了它们。
首先,我修改了权限,使其足够宽,使其能够工作(对于我需要的服务,S3和EC2):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*",
"ec2:*",
"cloudwatch:PutMetricData"
],
"Resource": [
"*"
]
}
]
}然后,通过将"ec2:*“中的*替换为我想调用的适当函数,将其缩小到我想要调用的确切命令。
https://stackoverflow.com/questions/26157673
复制相似问题