DeleteObject
Removes an object from a specified bucket, permanently deleting its data and associated metadata.
Stored Procedure-Specific Information
This procedure is the supported way to delete an object, because the Objects view does not support SQL DELETE. If the bucket has versioning enabled, set VersionId to delete a specific version of the object. Supply the ETag input to delete the object only when it has not changed; a mismatch fails with a 412 Precondition Failed error. Set ExpectedBucketOwner to require that the bucket belongs to a specific AWS account before the deletion proceeds.The following example deletes an object:
EXECUTE DeleteObject
@Bucket='BucketName',
@Object='ObjectName'
Input
| Name | Type | Required | Description |
| Bucket | String | True | The name of the S3 bucket that contains the object to be deleted. |
| Object | String | True | The key (name) of the object within the bucket that should be permanently removed. |
| ETag | String | False | An optional entity tag (ETag) for conditional deletes. When provided, the deletion is performed only if the current ETag of the object matches this value, preventing accidental deletion of an object that has been modified by another process. If the values do not match, the request fails with a 412 Precondition Failed error. |
| ExpectedBucketOwner | String | False | The AWS account ID expected to own the bucket. The request fails if the actual owner does not match. |
| VersionId | String | False | The specific version of the object to delete. If omitted, a delete marker is created for a versioned object instead of permanently removing it. |
Result Set Columns
| Name | Type | Description |
| Status | String | Indicates the result of the delete operation, such as success or failure. |