delete-object

Prev Next

Available in Classic and VPC

Delete an object stored in a Ncloud Storage bucket.

Note

For a Sub Account user to execute this command, they must have the Change/DeleteObject action permission. If you bypass GOVERNANCE retention to delete an item (--bypass-governance-retention), you will need the additional Change/BypassGovernanceretention action permission.

Syntax

The delete-object syntax is as follows:

aws s3api delete-object \
    --bucket <bucket> \
    --key <key> \
    [--version-id <version-id>] \
    [--bypass-governance-retention | --no-bypass-governance-retention] \
    --endpoint-url <endpoint-url>
Note

The behavior may vary depending on the version control settings of the bucket where the target object is stored.

  • If version control is not enabled for the bucket, the object will be permanently deleted.
  • If versioning is enabled, a delete marker is inserted into the object, and this version becomes the object’s latest version. If you want to permanently delete the object, specify the version ID to delete it.
  • If versioning is paused, calling the command without specifying a version ID will only delete objects with a version ID of NULL. If an object with a version ID is the current version, a delete marker with a version ID of NULL is inserted, and this delete marker becomes the current version of the object. To delete a specific version of the object, specify the version ID to delete that version.

Options

This section describes the options available when running delete-object.

Required options

The following options are required for delete-object.

Options Type Required Description
--bucket String Required Bucket name
--key String Required Object name

Optional options

These are the optional options for delete-object. Options that are not specified will use their default values.

Options Type Required Description
--version-id String Optional Object version ID
  • When deleting a specific version of an object from a bucket with versioning enabled
--bypass-governance-retention Boolean Optional Bypasses the GOVERNANCE mode retention settings
  • Use this to delete object versions with GOVERNANCE retention enabled.
  • Bypass permission required.
--no-bypass-governance-retention Boolean Optional Does not bypass GOVERNANCE mode preservation settings.

Common options

For information about the options common to all aws subcommands, see Ncloud Storage options.

Examples

If the request to delete an object is successful, the object is deleted, and no result is displayed.

Command

The command example is as follows:

aws s3api delete-object --bucket my-test-bucket \
    --key img/copy.png \
    --endpoint-url=https://kr.ncloudstorage.com

Related commands

Related commands are as follows: