The Delete S3 Objects action can be used to delete many S3 objects based on specific criteria. Possible criteria includes the object's name, prefix, age, or any of the objects metadata.
For example, it can be used to:
delete all objects
delete all objects older than 7 days
delete only objects that contain "backup" in it's name.
delete objects that contain "backup" in it's name and are older than 5 days
delete objects that have a metadata key called "Retention" with value "14-days" and are older than 14 days
The Delete S3 Objects action includes a "test mode" as a way of determining which objects will be deleted without actually deleting the objects. This way, you can fine tune your action without concern for deleting the wrong objects. Test Mode is on by default.
When test mode is enabled, execute your action normally then check the action logs to verify that only objects that should have been deleted would have been deleted, and that objects that should not have been deleted would not have been deleted.
When you are satisfied, disable Test Mode.
Criteria acts as a filter. If no criteria is specified, all objects will be deleted.
Please see Common Action Settings for a description of settings common to all action types.
Name of the bucket in which to delete objects.
Optional. Only objects with the specified prefix will be deleted.
Optional. When enabled, this indicates a way to compare object information as a way to include or exclude objects from deletion.
Required if "Delete Comparison" is set to "Metadata Key".
Specifies the Metadata Key to examine when determining whether to include the object in the list of objects to delete.
Older Than (days)
Optional. When enabled, only objects older than the specified number of days will be deleted.
Enables and disabled Test Mode (see above).
Amazon Commands Used
The following Amazon AWS commands are used. The access key should have permission to execute all of them.