Skip to main content

Delete object

For your information

If the bucket has a bucket policy, it must allow object deletion; learn more in the Actions subsection of the Bucket policy guide.

When deleting an object, take into account the specifics of deleting segmented objects.

If versioning is enabled or suspended in the bucket, some objects can be restored after deletion; learn more in the Delete an object with versioning enabled or suspended subsection. If versioning in the bucket is disabled (has never been enabled), the object is deleted permanently.

If an object has an active lock (Object Lock), the ability to delete it depends on the lock type and mode; learn more in the Delete an object with Object Lock subsection.

When deleting objects via the S3 API, you can use conditional requests.

Delete object

  1. In the control panel, in the top menu, click Products and select S3.
  2. Go to the Buckets section.
  3. Open the bucket page → Objects tab.
  4. Select the object you want to delete.
  5. Click Delete.
  6. Enter delete to confirm deletion.
  7. Click Start deletion.

Delete a segmented object

carefully

When storing an object, do not delete its segments in the service bucket — this will break the entire file.

To delete a segmented object, delete the manifest file. For deletion, use the API that you used to upload the object. When deleting via the control panel, the Swift API is used.

If uploading and deleting an object are performed in different ways (for example, the object was uploaded via S3 API but deleted in the control panel), the object segments might not be deleted; they will remain in the hidden bucket and continue to be billed.

Delete an object with versioning enabled or suspended

If versioning in the bucket is enabled or suspended, the object may have versions — objects with the same name that were uploaded earlier than the current version of the object.

The behavior when deleting an object depends on whether you are deleting the object with or without specifying a version:

  • when deleting without specifying a version, the current version of the object is moved to the list of versions. An empty object with its own version ID and the Deleted tag will be created as the current version. To make the object available to users, restore it from any version that does not have the Deleted tag.

  • when deleting a specific version, the version is permanently deleted. If the version being deleted is:

    • the current version — the version will become an empty object and move to the list of versions with the Deleted tag. The current version of the object becomes the most recent version from the list that does not have the Deleted tag;
    • previous — it will be removed from the version list entirely.

    If the version being deleted is the only one, the object cannot be restored.

Delete an object without specifying a version

For your information

To delete an object without specifying a version via the API or other tools, do not specify the version-id parameter.

  1. In the control panel, in the top menu, click Products and select S3.
  2. Go to the Buckets section.
  3. Open the bucket page → Objects tab.
  4. Make sure that the Versions toggle is turned off.
  5. Select the object you want to delete.
  6. Click Delete.
  7. Enter delete to confirm deletion.
  8. Click Start deletion.

Delete a specific version

For your information

To delete a specific version via the API or other tools, specify the version-id parameter with the version ID value.

  1. In the control panel, in the top menu, click Products and select S3.
  2. Go to the Buckets section.
  3. Open the bucket page → Objects tab.
  4. Turn on the Versions toggle.
  5. Select the version you want to delete.
  6. Click Delete.
  7. Enter delete to confirm deletion.
  8. Click Start deletion.

Delete an object with Object Lock

If an object has an active lock, the ability to delete it depends on the lock type and mode:

  • legal hold — to delete, you must disable the lock;

  • retention period:

    • in Governance mode — only a user with the member role or a user with another role if the bucket policy allows them the action s3:BypassGovernanceRetention can delete the object. Other users will be able to delete the object only after the lock period expires;
    • in Compliance mode — the object cannot be deleted before the lock period expires.

In buckets with Object Lock, operations to delete objects with an active lock via the control panel, Swift API, and Swift API (old) will return an error. To bypass the lock via the action of the bucket policy s3:BypassGovernance or disable it, use the S3 API or tools that use it, for example, AWS CLI.