Use GetBucketEncryption with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use GetBucketEncryption with an AWS SDK or CLI

The following code examples show how to use GetBucketEncryption.

CLI
AWS CLI

To retrieve the server-side encryption configuration for a bucket

The following get-bucket-encryption example retrieves the server-side encryption configuration for the bucket my-bucket.

aws s3api get-bucket-encryption \ --bucket my-bucket

Output:

{ "ServerSideEncryptionConfiguration": { "Rules": [ { "ApplyServerSideEncryptionByDefault": { "SSEAlgorithm": "AES256" } } ] } }
PowerShell
Tools for PowerShell

Example 1: This command returns all the server side encryption rules associated with the given bucket.

Get-S3BucketEncryption -BucketName 's3casetestbucket'