delete-object

Prev Next

Available in Classic and VPC

Delete an object stored in Object Storage.

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>

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 Object 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.object.ncloudstorage.com