I am trying to enable default encryption for s3 Bucket programmatically. Following is not working no errors as well. Anybody know the reason for this ?
private async Task<PutBucketEncryptionResponse> EnableServerSideEncriptionAsync(string bucketName)
{
return await S3Client.PutBucketEncryptionAsync(new PutBucketEncryptionRequest
{
BucketName = bucketName,
ServerSideEncryptionConfiguration = new ServerSideEncryptionConfiguration()
{
ServerSideEncryptionRules = new List<ServerSideEncryptionRule>()
{
new ServerSideEncryptionRule()
{
ServerSideEncryptionByDefault = new ServerSideEncryptionByDefault()
{
ServerSideEncryptionAlgorithm = ServerSideEncryptionMethod.AES256
}
}
}
}
});
}
I tried it using the AWS Command-Line Interface (CLI) to see what would happen.
I created a new bucket, and ran:
aws s3api put-bucket-encryption --bucket my-bucket --server-side-encryption-configuration '{"Rules": [{"ApplyServerSideEncryptionByDefault": {"SSEAlgorithm": "AES256"}}]}'
I then went to the bucket in the Amazon S3 console, clicked the Properties tab and the Default Encryption box displayed: AES-256

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With