CloudFormation,Lambda,S3 - s3拒绝访问

时间:2017-05-15 14:22:43

标签: amazon-web-services amazon-s3 aws-lambda amazon-cloudformation

所以我试图运行这个cloudformation脚本,但是我收到了这个错误:

  
      
  • Your access has been denied by S3, please make sure your request credentials have permission to GetObject for s3.XXXX.amazonaws.com/s3-bucket/folder-1/folder-2/code.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied
  •   

我甚至尝试过制作我的code.zip公开!这不是我想要做的理想......

这是我的代码:

"lambdafunction": {
     "Type": "AWS::Lambda::Function",
     "DependsOn": [
         "other1",
         "other2",
         "other3"
     ],
     "Properties": {
         "Code": {
             "S3Bucket": "s3.XXXX.amazonaws.com",
             "S3Key": "s3-bucket/folder-1/folder-2/code.zip"
         },
         "Role": {
             "Fn::GetAtt": [
                 "accessrole",
                 "Arn"
             ]
         },
         "Timeout": 60,
         "Handler": "lambda_function.lambda_handler",
         "Runtime": "python2.7",
         "MemorySize": 1024
     },
     "Metadata": {
         "AWS::CloudFormation::Designer": {
             "id": "XXXX"
         }
     }
 },

提前致谢!

1 个答案:

答案 0 :(得分:3)

事实证明代码部分是错误的,需要命名存储桶URL

 "Code": {
     "S3Bucket": "s3-bucket",
     "S3Key": "folder-1/folder-2/code.zip"
 },