【问题标题】:aws-ec2 - you are not authorized to perform this operationaws-ec2 - 您无权执行此操作
【发布时间】:2014-06-04 20:18:34
【问题描述】:

我对aws等最不熟悉。目前正在尝试将一个小的war文件上传到s3存储桶using s3-bashPalletOps。为此,我将 clojure 配置文件配置为

(defpallet :default-service
           :vmfest
           :services {:localhost {:provider "localhost"}
                      :vmfest {:provider                "vmfest"
                               :vbox-comm               :ws
                               :default-network-type    :local
                               :default-memory-size     1024
                               :default-local-interface "vboxnet5"}
                      :aws-ec2 {:provider   "aws-ec2"
                                :identity   "AAAAAAAAAAAAAAAAAAQ"
                                :credential "ATMz1/gerGGFHDh/GFGGFGFGFHFHFHGTUUTUgdgdgdg"}})

在 aws 上,我向该用户添加了 IAM 策略,

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iam:*",
      "Resource": "*"
    }
  ]
}

在尝试lein pallet up -P aws-ec2 使用上述 config 的集群时出现以下错误,

Caused by: org.jclouds.aws.AWSResponseException: request POST
  https://ec2.us-east-1.amazonaws.com/ HTTP/1.1 failed with code 403,
        error: AWSError{requestId='c20a65f1-64a1-4d7f-be27-690d495ffd09',
        requestToken='null', code='UnauthorizedOperation', message='You are not
        authorized to perform this operation.', context='{Response=, Errors=}'}
    at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError(ParseAWSErrorFromXmlContent.java:77)
    ... 77 more
Subprocess failed

我也在https://policysim.aws.amazon.com/home/index.jsp?# 尝试过模拟,但即使是“ListBucket”操作也失败了,错误为Implicitly denied (no matching statements found).

我可能是missing to configure on aws ec2,但无法继续前进。

【问题讨论】:

    标签: amazon-web-services clojure amazon-ec2 amazon-s3 pallet


    【解决方案1】:

    我认为您可能需要在 IAM 政策中添加 s3* 条目:

    以下是仅允许上传到特定文件夹的策略示例:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Action": [
            "s3:*"
          ],
          "Sid": "Stmt13NNNNNNNN000",
          "Resource": [
            "arn:aws:s3:::bucket-name/specific-folder/*"
          ],
          "Effect": "Allow"
        },
    {
          "Action": [
            "s3:*"
          ],
          "Sid": "StmtNNNNNNNNNNN",
          "Resource": [
            "arn:aws:s3:::bucket-name"
          ],
           "Effect": "Allow"
         }
       ] 
     }
    

    还值得在“超级用户”预建策略(如果可以)中使用凭据进行测试,以排除此类权限问题。

    【讨论】:

    • 嗨,亚瑟,感谢您的精彩回答。不知道什么有效,几个小时后,我的问题中的同样的事情工作正常。 (海森伯格)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-30
    • 1970-01-01
    • 2021-10-17
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    相关资源
    最近更新 更多