Closed tyner closed 8 months ago
I believe this type of things can be done with the current implementation. Any extra arguments (...) are passed to paws i.e.
Edit:
s3fs::s3_file_upload(
"NEWS.md",
"s3://mybucket/NEWS.md",
ServerSideEncryption = "aws:kms",
SSEKMSKeyId = "my-key-id"
)
https://dyfanjones.github.io/s3fs/reference/upload.html
Note: parameter SSEKMSKeyId
, ServerSideEncryption
are passed to paws s3_put_object
However I believe there is a bug regarding this as I am gettingError: InvalidArgument (HTTP 400). Server Side Encryption with AWS KMS managed key requires HTTP header x-amz-server-side-encryption : aws:kms
Note: this error was due to me not adding ServerSideEncryption
.
I hope this helps @tyner :)
Thanks @DyfanJones, what should be used for the SSEKMSKeyId
? I tried both the access_key_id
as well as the secret_access_key
supplied by aws.common::locate_credentials()
and in both cases s3fs::s3_file_upload
gave an error:
Error: KMS.NotFoundException (HTTP 400). Invalid keyId
SSEKMSKeyId is the kms key id. If your code with aws.s3 worked:
aws.s3::s3save(letters,
object = "letters.RData",
bucket = my_bucket,
opts = list(headers = c('x-amz-server-side-encryption' = 'aws:kms'))
)
Then the following should be fine as well :)
s3fs::s3_file_upload(
"NEWS.md",
"s3://mybucket/NEWS.md",
ServerSideEncryption = "aws:kms"
)
Note: both paws
and aws.s3
build the header x-amz-server-side-encryption
. paws
just uses the SDK interface (similar to boto3 :) )
Perfect, it does indeed work, thank you!
One nice thing about
aws.s3::s3save
is that it supports server side encryption, for example:Is it possible that
s3fs::s3_file_upload
,s3fs::s3_file_create
,s3fs::s3_file_touch
etc could support this as well? I looked through the help pages and it wasn't obvious...