Specifying server-side encryption with Amazon S3 managed keys (SSE-S3)
All Amazon S3 buckets have encryption configured by default, and all new objects that are uploaded
to an S3 bucket are automatically encrypted at rest. Server-side encryption with Amazon S3 managed keys (SSE-S3) is the default encryption
configuration for every bucket in Amazon S3. To use a different type of encryption, you can either specify the type of server-side encryption
to use in your S3 PUT requests, or you can update the default encryption configuration in the destination bucket.
If you want to specify a different encryption type in your PUT requests, you can use server-side encryption with
AWS Key Management Service (AWS KMS) keys (SSE-KMS), dual-layer server-side encryption with AWS KMS keys (DSSE-KMS), or server-side encryption with
customer-provided keys (SSE-C). If you want to set a different default encryption configuration in the destination bucket, you can use
SSE-KMS or DSSE-KMS.
For more information about changing the default encryption configuration for your general purpose buckets, see Configuring default encryption.
When you change the default encryption configuration of your bucket to SSE-KMS, the encryption type of the existing Amazon S3 objects in the bucket is not changed. To change the encryption type of your pre-existing objects after updating the default encryption configuration to SSE-KMS, you can use Amazon S3 Batch Operations. You provide S3 Batch Operations with a list of objects, and Batch Operations calls the respective API operation. You can use the Copy objects action to copy existing objects, which writes them back to the same bucket as SSE-KMS encrypted objects. A single Batch Operations job can perform the specified operation on billions of objects. For more information, see Performing object operations in bulk with Batch Operations and the AWS Storage Blog post How to retroactively encrypt existing objects in Amazon S3 using S3 Inventory, Amazon Athena, and S3 Batch Operations
You can specify SSE-S3 by using the S3 console, REST APIs, AWS SDKs, and AWS Command Line Interface (AWS CLI). For more information, see Setting default server-side encryption behavior for Amazon S3 buckets.
This topic describes how to set or change the type of encryption an object by using the AWS Management Console. When you copy an object by using the console, Amazon S3 copies the object as is. That means that if the source object is encrypted, the target object is also encrypted. You can use the console to add or change encryption for an object.
Note
-
You can change an object's encryption if your object is less than 5 GB. If your object is greater than 5 GB, you must use the AWS CLI or AWS SDKs to change an object's encryption.
-
For a list of additional permissions required to change an object's encryption, see Required permissions for Amazon S3 API operations. For example policies that grant this permission, see Identity-based policy examples for Amazon S3.
If you change an object's encryption, a new object is created to replace the old one. If S3 Versioning is enabled, a new version of the object is created, and the existing object becomes an older version. The role that changes the property also becomes the owner of the new object (or object version).
To change encryption for an object
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
In the navigation pane, choose Buckets, and then choose the General purpose buckets tab. Navigate to the Amazon S3 bucket or folder that contains the objects you want to change.
-
Select the check box for the objects you want to change.
-
On the Actions menu, choose Edit server-side encryption from the list of options that appears.
Scroll to the Server-side encryption section.
Under Encryption settings, choose Use bucket settings for default encryption or Override bucket settings for default encryption.
-
If you chose Override bucket settings for default encryption, configure the following encryption settings.
-
Under Encryption type, choose Server-side encryption with Amazon S3 managed keys (SSE-S3). SSE-S3 uses one of the strongest block ciphers—256-bit Advanced Encryption Standard (AES-256) to encrypt each object. For more information, see Using server-side encryption with Amazon S3 managed keys (SSE-S3).
-
-
Under Additional copy settings, choose whether you want to Copy source settings, Don’t specify settings, or Specify settings. Copy source settings is the default option. If you only want to copy the object without the source settings attributes, choose Don’t specify settings. Choose Specify settings to specify settings for storage class, ACLs, object tags, metadata, server-side encryption, and additional checksums.
-
Choose Save changes.
Note
This action applies encryption to all specified objects. When you're encrypting folders, wait for the save operation to finish before adding new objects to the folder.
At the time of object creation—that is, when you are uploading a new object or
making a copy of an existing object—you can specify if you want Amazon S3 to encrypt your
data with Amazon S3 managed keys (SSE-S3) by adding the x-amz-server-side-encryption
header to the request. Set the value of the header to the encryption algorithm
AES256, which Amazon S3 supports. Amazon S3 confirms that your object is stored with
SSE-S3 by returning the response header x-amz-server-side-encryption.
The following REST upload API operations accept the
x-amz-server-side-encryption request header.
When uploading large objects by using the multipart upload API operation, you can
specify server-side encryption by adding the x-amz-server-side-encryption
header to the Initiate Multipart Upload request. When you're copying an existing object,
regardless of whether the source object is encrypted or not, the destination object is not
encrypted unless you explicitly request server-side encryption.
The response headers of the following REST API operations return the
x-amz-server-side-encryption header when an object is stored using SSE-S3.
Note
Do not send encryption request headers for GET requests and
HEAD requests if your object uses SSE-S3, or you'll get an HTTP status code
400 (Bad Request) error.
When using AWS SDKs, you can request Amazon S3 to use server-side encryption with Amazon S3
managed encryption keys (SSE-S3). This section provides examples of using the AWS SDKs in
multiple languages. For information about other SDKs, go to Sample Code and Libraries