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 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.
To delete an object
Sign in to the Amazon Web Services Management Console and open the Amazon S3 console at https://console.amazonaws.cn/s3/
. -
In the Bucket name list, choose the name of the bucket that you want to delete an object from.
-
To delete an object in a versioning-enabled bucket with versioning:
Disabled, Amazon S3 creates a delete marker. To delete the object, select the object, and choose delete and confirm your choice by typing
delete
in the text field.-
Enabled, Amazon S3 will permanently delete the object version. Select the object version that you want to delete, and choose delete and confirm your choice by typing
permanently delete
in the text field.
The following examples show how you can use the Amazon 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 Using versioning in S3 buckets.
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 Amazon 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.