简体   繁体   中英

CloudFormation Lambda S3 bucket access denied

In my CloudFormation template I have a lambda whose code lives on S3:

MyLambda:
  Properties:
    Code:
      S3Bucket: bucket-name
      S3Key: filename.zip
  Handler: handler
  MemorySize: !Ref 'LambdaMemorySize'
  Role: arn:aws:iam::XXXXXXXXXXX:role/my-role
  Runtime: python3.6
  Timeout: !Ref 'LambdaTimeout'
Type: AWS::Lambda::Function

If I run this from the AWS console, then it works fine. However, when I run this from the AWS CLI (or boto) then it doesn't work, so I guess there must be something missing from my user's credentials that's stopping this working. However my IAM user has administrator access:

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

Error message:

Your access has been denied by S3, please make sure your request credentials have permission to GetObject for bucket-name/filename.zip. 
S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: AWSLambda; Status Code: 403; Error Code: AccessDeniedException; Request ID: xxxxx)

事实证明,这是由于参加IP白名单的小组的一部分-删除该问题即可解决。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM