aws-samples/cloudfront-authorization-at-edge

Add support for custom S3 bucket

wzr1337 opened this issue · 1 comments

I would need an option/parameter to provide my own private s3 bucket. I checked the code but I am not yet able to figure out where to change the behavior

You've hit the longest outstanding feature request: #20

It's problematic to implement it, because:

  • This solution, when it creates the CloudFront distribution, it also creates an Origin Access Identity (OAI)
  • The OAI is granted access via the Bucket's Policy. But if you're bringing an existing Bucket, there might be a Bucket Policy on it already, so we can't simply add a new AWS::S3::BucketPolicy to the stack.

Maybe it would be best to have 2 new parameters then:

  • BucketName
  • OriginAccessIdentity

So you would need to create both yourself, and wire them up appropriately, and pass them to this solution.

What do you think?

BTW Not sure you saw already, but you can use your own bucket already with this solution, if you are also bringing a pre-existing CloudFront distribution: https://github.com/aws-samples/cloudfront-authorization-at-edge#i-already-have-an-s3-bucket-i-want-to-use-that-one