Deleting a single object
You can use the Amazon S3 console or the DELETE API to delete a single existing object from an S3 bucket. For more information about deleting objects in Amazon S3, see Deleting Amazon S3 objects.
Because all objects in your S3 bucket incur storage costs, you should delete objects that you no longer need. For example, if you are collecting log files, it's a good idea to delete them when they're no longer needed. You can set up a lifecycle rule to automatically delete objects such as log files. For more information, see Setting an S3 Lifecycle configuration on a bucket.
For information about Amazon S3 features and pricing, see Amazon S3 pricing
Follow these steps to use the Amazon S3 console to delete a single object from a bucket.
Warning
When you permanently delete an object or specified object version in the Amazon S3 console, the deletion can't be undone.
To delete an object that has versioning enabled or suspended
Note
If the version ID for an object in a versioning-suspended bucket is
marked as NULL
, S3 permanently deletes the object since no
previous versions exist. However, if a valid version ID is listed for the object
in a versioning-suspended bucket, then S3 creates a delete marker for the
deleted object, while retaining the previous versions of the object.
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
In the Bucket name list, choose the name of the bucket that you want to delete an object from.
Select the object and then choose Delete.
To confirm deletion of the objects list under Specified objects in the Delete objects? text box, enter
delete
.
To permanently delete a specific object version in a versioning-enabled bucket
Warning
When you permanently delete a specific object version in Amazon S3, the deletion can't be undone.
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
In the Bucket name list, choose the name of the bucket that you want to delete an object from.
Select the object that you want to delete.
Choose the Show versions toggle.
Select the object version and then choose Delete.
To confirm permanent deletion of the specific object versions listed under Specified objects, in the Delete objects? text box, enter Permanently delete. Amazon S3 permanently deletes the specific object version.
To permanently delete an object in an Amazon S3 bucket that doesn't have versioning enabled
Warning
When you permanently delete an object in Amazon S3, the deletion can't be undone. Also, for any buckets without versioning enabled, deletions are permanent.
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
In the Bucket name list, choose the name of the bucket that you want to delete an object from.
Select the object and then choose Delete.
To confirm permanent deletion of the object listed under Specified objects, in the Delete objects? text box, enter permanently delete.
Note
If you're experiencing any issues with deleting your object, see I want to permanently delete versioned objects.
To delete one object per request, use the DELETE
API. For more
information, see DELETE
Object. For more information about using the CLI to delete an object,
see delete-object
You can use the AWS SDKs to delete an object. However, if your application requires it, you can send REST requests directly. For more information, see DELETE Object in the Amazon Simple Storage Service API Reference.
The following examples show how you can use the AWS SDKs to delete an object from a bucket. For more information, see DELETE Object in the Amazon Simple Storage Service API Reference
If you have S3 Versioning enabled on the bucket, you have the following options:
-
Delete a specific object version by specifying a version ID.
-
Delete an object without specifying a version ID, in which case Amazon S3 adds a delete marker to the object.
For more information about S3 Versioning, see Retaining multiple versions of objects with S3 Versioning.