Serverless-application-model: S3CrudPolicy in Lambda should also includes s3:PutObjectAcl

Created on 15 Jun 2018  路  5Comments  路  Source: aws/serverless-application-model

Correct me if I'm wrong, but it looks like unless you explicitly set s3:PutObjectAcl, your lambda function can not create new bucket objects.

It only works if I explicitly add a new policy with s3:PutObjectAcl.

Example:

  Function:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Ref FunctionName
      AutoPublishAlias: !Ref StageName
      Description: "..."
      Handler: main.handler
      Runtime: nodejs8.10
      MemorySize: 1536 # Mo
      CodeUri: ../dist
      Policies:
        - S3CrudPolicy:
            BucketName: !Ref Bucket
        # This is actually required otherwise I'm unable to create object
        - Version: 2012-10-17
          Statement:
            - Effect: Allow
              Action: [ "s3:PutObjectAcl" ]
              Resource:
                - !GetAtt Bucket.Arn

If not, I get AccessDenied that I can see in CloudWatch when trying to run my lambda function.

Most helpful comment

The S3FullAccessPolicy includes this. It's broader than the Crud policy.

All 5 comments

The S3FullAccessPolicy includes this. It's broader than the Crud policy.

Thanks, that make sense!

@lafiosca

The S3FullAccessPolicy includes this. It's broader than the Crud policy.

this is not added in the documentation for SAM templates

@radiumrasheed It looks like it is added here

thanks, weird I didn't see it earlier

Was this page helpful?
0 / 5 - 0 ratings