How can I use Storage::disk(‘s3’)->put() when my s3’s x-amz-server-side-encryption is AES256 at Laravel 5.1?

Question:

RT.

This is my s3’s filesystem configure:

And this is my composer.json:

And this is my s3’s bucket policy:

Yes, I used "s3:x-amz-server-side-encryption": "AES256" as my PutObject’s condition, but I wanna use like this code:

But when I run it, I will got response like this:

So, how can I do this?
Thanks!

Answer:

(Laravel 5.3) If your bucket policy requires server side encryption for all objects, rather than access the S3 driver and pass arguments to that, I was able to universally enable S3 SSE by setting it as an option in the configuration:

config/filesystems.php

With the ServerSideEncryption option set in the configuration, I am able to make method calls on the “disk” directly.

Leave a Reply