Deletes an object from an OSS bucket.
Prerequisites
Before you begin, ensure that you have:
The
oss:DeleteObjectpermission. By default, an Alibaba Cloud account has this permission. To grant the permission to a RAM user or Security Token Service (STS) role, see Attach a custom policy to a RAM user
Usage notes
Symbolic links: Deleting a symbolic link removes the link itself, not the object it points to.
Command syntax
ossutil api delete-object --bucket <value> --key <value> [--version-id <value>] [flags]Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
--bucket | string | Yes | Name of the bucket. |
--key | string | Yes | Full path of the object. |
--version-id | string | No | Version ID of the object. |
Note
The delete-object command corresponds to the DeleteObject API operation. For supported global flags, see Command-line options.
Examples
Delete the exampleobject object from examplebucket:
ossutil api delete-object --bucket examplebucket --key exampleobjectPermanently delete a specific version of the exampleobject object:
ossutil api delete-object --bucket examplebucket --key exampleobject --version-id 123