1

After reading S3WritePolicy documentation, it's not clear if it allows multiple buckets.

I'm currently doing this:

SampleLambdaFunction:
  Type: AWS::Serverless::Function
  Properties:
    Policies:
      - S3WritePolicy:
          BucketName: bucket-1

but if I wanted to include multiple buckets, i.e.:

SampleLambdaFunction:
  Type: AWS::Serverless::Function
  Properties:
    Policies:
      - S3WritePolicy:
          BucketName: 
             - bucket-1
             - bucket-2

would this be allowed?

andres
  • 73
  • 6

1 Answers1

1

Does S3WritePolicy allow multiple buckets in AWS SAM template?

Yes.

would this be allowed?

No, but the below would be allowed.

This is because it's a SAM policy template & is essentially generating a policy for a single bucket. You can however use it as many times as needed.

SampleLambdaFunction:
  Type: AWS::Serverless::Function
  Properties:
    Policies:
      - S3WritePolicy:
          BucketName: 
             - bucket-1
      - S3WritePolicy:
          BucketName: 
             - bucket-2
Ermiya Eskandary
  • 15,323
  • 3
  • 31
  • 44