Deleting multiple 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
You can use the Amazon S3 console or the Multi-Object Delete API to delete multiple objects simultaneously from an S3 bucket.
Follow these steps to use the Amazon S3 console to delete multiple objects from a bucket.
To delete objects
-
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
Navigate to the Amazon S3 bucket or folder that contains the objects that you want to delete.
-
Select the check box to the left of the names of the objects that you want to delete.
-
Choose Actions and choose Delete from the list of options that appears.
Alternatively, choose Delete from the options in the upper right.
-
Enter
delete
if asked to confirm that you want to delete these objects. -
Choose Delete objects in the bottom right and Amazon S3 deletes the specified objects.
-
Deleting the specified objects cannot be undone.
-
This action deletes all specified objects. When deleting folders, wait for the delete action to finish before adding new objects to the folder. Otherwise, new objects might be deleted as well.
-
Deleting the specified objects cannot be undone.
Amazon S3 provides the Multi-Object Delete API , which you can use to delete multiple objects in a single request. The API supports two modes for the response: verbose and quiet. By default, the operation uses verbose mode. In verbose mode, the response includes the result of the deletion of each key that is specified in your request. In quiet mode, the response includes only keys for which the delete operation encountered an error. If all keys are successfully deleted when you're using quiet mode, Amazon S3 returns an empty response. For more information, see Delete - Multi-Object Delete.
To learn more about object deletion, see Deleting Amazon S3 objects.
You can use the AWS SDKs to delete multiple objects using the Multi-Object Delete API. However, if your application requires it, you can send REST requests directly.
For more information, see Delete Multiple Objects in the Amazon Simple Storage Service API Reference.