Renaming objects in directory buckets
Using the RenameObject operation, you can atomically rename an existing
        object in a directory bucket that uses the S3 Express One Zone storage class, without any data
        movement. You can rename an object by specifying the existing object’s name as the source
        and the new name of the object as the destination within the same directory bucket. The
            RenameObject API operation will not succeed on objects that end with the
        slash (/) delimiter character. For more information, see Naming Amazon S3
            objects.
The RenameObject operation is typically completed in milliseconds
        regardless of the size of the object. This capability accelerates applications like log file
        management, media processing, and data analytics. Additionally, RenameObject preserves all
        object metadata properties, including the storage class, encryption type, creation date,
        last modified date, and checksum properties.
Note
RenameObject is only supported for objects stored in the S3 Express One Zone storage class.
 To grant access to the RenameObject operation, we recommend that you use the
            CreateSession operation for session-based authorization. Specifically, you
        grant the s3express:CreateSession permission to the directory bucket in a
        bucket policy or an identity-based policy. Then, you make the CreateSession API
        call on the directory bucket to obtain a session token. With the session token in your
        request header, you can make API requests to this operation. After the session token
        expires, you make another CreateSession API call to generate a new session
        token for use. The AWS CLI and AWS SDKs will create and manage your session including
        refreshing the session token automatically to avoid service interruptions when a session
        expires. For more information about authorization, see CreateSession in
        the Amazon S3 API Reference. To learn more about Zonal endpoint API
        operations, see Authorizing Zonal
            endpoint API operations with CreateSession. 
 If you don't want to overwrite an existing object, you can add the
            If-None-Match conditional header with the value ‘*’ in the
            RenameObject request. Amazon S3 returns a 412 Precondition Failed
        error if the object name already exists. For more information, see RenameObject in the Amazon S3 API Reference.
        
 RenameObject is a Zonal endpoint API operation (object-level or data plane operation) that is logged to
        AWS CloudTrail. You can use CloudTrail to gather information on the RenameObject operation
        performed on your objects in directory buckets. For more information, see Logging with AWS CloudTrail for directory buckets and CloudTrail log file examples for
                directory buckets. 
S3 Express One Zone is the only storage class that supports RenameObject, which is priced the same as PUT, 
        COPY, POST, and LIST requests (per 1,000 requests) in S3 Express One Zone.
        For more information, see Amazon S3
            pricing
Renaming an object
To rename an object in your directory bucket, you can use the Amazon S3 console, AWS CLI, AWS SDKs, the REST API or Mountpoint for Amazon S3 (version 1.19.0 or higher).
To rename an object in a directory bucket
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 Directory buckets tab. Navigate to the Amazon S3 directory bucket that contains the object that you want to rename.
 - 
                            
Select the check box for the object that you want to rename.
 - 
                            
On the Actions menu, choose Rename object.
 - 
                            
In the New object name box, enter the new name for the object.
Note
If you specify the same object name as an existing object, the operation will fail and Amazon S3 returns a
412 Precondition Failederror. The object key name length can't exceed 1,024 bytes. Prefixes included in the object name count toward the total length. Choose Rename object. Amazon S3 renames your object.
The rename-object examples show how you can use the
                    AWS CLI to rename an object. To run these commands, replace the
                        user input placeholders with your own
                    information
The following example shows how to rename an object with a conditional check on the source object's ETag.
aws s3api rename-object \ --bucketamzn-s3-demo-bucket--usw2-az1--x-s3\ --keynew-file.txt\ --rename-sourceoriginal-file.txt\ --source-if-match "\"a1b7c3d2e5f6\""
This command does the following:
Renames an object from
original-file.txttonew-file.txtin theamzn-s3-demo-bucket--usw2-az1--x-s3directory bucket.Only performs the rename if the source object's ETag matches "
a1b7c3d4e5f6".
If the ETag doesn't match, the operation will fail with a 412
                        Precondition Failed error. 
The following example shows how to rename an object with a conditional check on the new specified object name.
aws s3api rename-object \ --bucketamzn-s3-demo-bucket--usw2-az1--x-s3\ --keynew-file.txt\ --rename-sourceamzn-s3-demo-bucket--usw2-az1--x-s3/original-file.txt\ --destination-if-none-match "\"e5f3g7h8i9j0\""
This command does the following:
Renames an object from
original-file.txttonew-file.txtin theamzn-s3-demo-bucket--usw2-az1--x-s3directory bucket.Only performs the rename operation if the object exists and the object's ETag doesn't match "
e5f3g7h8i9j0".
If an object already exists with the new specified name and the matching ETag,
                    the operation will fail with a 412 Precondition Failed error. 
 You can send REST requests to rename an object. For more information, see RenameObject in the Amazon S3 API Reference.
                
Starting with the 1.19.0 version or higher, Mountpoint for Amazon S3 supports renaming objects in S3 Express One Zone. For more information on Mountpoint, see Working with Mountpoint.