【问题标题】:boto elastic beanstalk CreateApplicationVersion 403 Forbiddenboto elastic beanstalk CreateApplicationVersion 403 Forbidden
【发布时间】:2014-06-27 05:22:25
【问题描述】:

我已经完成了一个自动部署到 Elastic beanstalk 的 python 脚本。

它适用于测试环境。

但是当我刚刚更改用户密钥时,Boto 使用正确的策略说“403 Forbidden”。

https://policysim.aws.amazon.com 表示用户允许 CreateApplicationVersion。

但是 boto 不允许 CreateApplicationVersion 操作。

boto==2.28
python==2.7.5

以前有人遇到过这个问题吗?

Traceback (most recent call last):
  File "upload_to_aws.py", line 135, in <module> 
description=None, s3_bucket=AWS_ELASTIC_BEANSTALK_S3_BUCKET_NAME, s3_key=zip_file)
  File "/usr/lib/python2.7/site-packages/boto/beanstalk/layer1.py", line 156, in create_application_version
return self._get_response('CreateApplicationVersion', params)
  File "/usr/lib/python2.7/site-packages/boto/beanstalk/layer1.py", line 71, in _get_response
raise self.ResponseError(response.status, response.reason, body)
boto.exception.BotoServerError: BotoServerError: 403 Forbidden
{"Error":{"Code":"AccessDenied","Message":"User: arn:aws:iam::<account-id>:user/<username> is not authorized to perform: elasticbeanstalk:CreateApplicationVersion on resource: arn:aws:elasticbeanstalk:ap-northeast-1:<account-id>:applicationversion/<application-name>/<application-version>","Type":"Sender"},"RequestId":"<request-id>"}

IAM 政策:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1000000000000",
      "Effect": "Allow",
      "Action": [
        "s3:*"
      ],
      "Resource": [
        "arn:aws:s3:::mybucket/*",
        "arn:aws:s3:::mybucket",
      ]
    },
{
      "Sid": "Stmt1000000000001",
      "Effect": "Allow",
      "Action": [
        "elasticbeanstalk:*"
      ],
      "Resource": [
        "arn:aws:elasticbeanstalk:ap-northeast-1:<account-id>:environment/<application name>/<environment-name>"
      ]
    }
  ]
}

【问题讨论】:

    标签: python amazon-web-services amazon-elastic-beanstalk boto


    【解决方案1】:

    我真的不认为这是一个博托问题。它只是使用您提供的凭据进行 API 调用。如果服务显示403,则您使用的凭据未获得该操作的授权。

    CreateApplicationVersion 操作的情况下,您还必须传入版本数据所在的 S3 存储桶。您使用的帐户是否有权访问该存储桶?

    【讨论】:

    • 非常感谢您的回复。在 CreateApplicationVersion 操作之前,我将 zip 文件上传到 S3 存储桶。它上传得很好。但是当我尝试 CreateApplicationVersion 操作时,它显示 403。其他一些操作,如 describe_applications()、describe_environments(application_name=AWS_ELASTIC_BEANSTALK_APP_NAME) 可以正常工作。
    猜你喜欢
    • 2018-05-28
    • 2014-10-17
    • 2021-07-03
    • 2013-04-24
    • 2018-03-11
    • 2016-06-05
    • 2014-02-14
    • 2017-07-09
    • 2015-12-05
    相关资源
    最近更新 更多