Skip to main content

Delete Bucket

Deletes an empty S3 bucket from your AWS account or S3-compatible storage service.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Client Id - The client connection ID from the Connect node. Optional if using credentials directly.
  • Bucket Name - The name of the bucket to delete. The bucket must be empty before it can be deleted.

Options

  • End Point - S3 endpoint URL. Required only if using credentials directly instead of Client ID.
  • Access Key Id - AWS Access Key ID credential. Optional - use this instead of Client ID for direct authentication.
  • Secret Key Access - AWS Secret Access Key credential. Optional - use this instead of Client ID for direct authentication.

How It Works

The Delete Bucket node permanently removes an empty S3 bucket. When executed, the node:

  1. Retrieves the S3 client using either the Client ID or creates a new client from credentials
  2. Validates that the bucket name is provided and not empty
  3. Sends a request to S3 to delete the specified bucket
  4. Completes successfully once the bucket is deleted

Requirements

  • Either a valid Client ID from a Connect node, or Access Key ID and Secret Access Key credentials
  • A valid bucket name
  • The bucket must be completely empty (no objects, including versioned objects and delete markers)
  • Appropriate S3 permissions to delete buckets (s3:DeleteBucket)

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid bucket name
  • Bucket does not exist
  • Bucket is not empty (contains objects)
  • Invalid Client ID or credentials
  • Insufficient permissions to delete buckets
  • Network or connection errors

Usage Notes

  • The bucket must be completely empty before deletion
  • This includes all object versions and delete markers in versioned buckets
  • Bucket deletion is permanent and cannot be undone
  • After deletion, the bucket name becomes available for reuse by any AWS account
  • If you want to reuse the same bucket name, delete and recreate it immediately
  • Bucket deletion is eventually consistent
  • There is no confirmation prompt - the deletion happens immediately

Best Practices

  • Always verify the bucket is empty before attempting deletion
  • Use the List Objects node to check for remaining objects
  • Delete all objects in the bucket first using the Delete Object node in a loop
  • For versioned buckets, delete all object versions and delete markers
  • Double-check the bucket name before deletion to avoid accidental data loss
  • Consider bucket lifecycle policies as an alternative to manual deletion
  • Keep backups of important data before deleting buckets
  • Document why buckets are being deleted for audit purposes

Example

To delete an empty bucket:

Inputs:

  • Client Id: (from Connect node)
  • Bucket Name: my-old-temporary-bucket

Result: The bucket my-old-temporary-bucket will be permanently deleted from your AWS account.

Complete Deletion Flow

To safely delete a bucket with objects, follow this pattern:

  1. List Objects - Get all objects in the bucket
  2. Loop through objects - For each object:
    • Delete Object - Remove the object
  3. Delete Bucket - Remove the empty bucket

Example automation flow:

Step 1: List Objects

  • Bucket Name: my-bucket-to-delete
  • Output: Array of objects

Step 2: For Each Object (Loop)

  • Delete Object node
  • Bucket Name: my-bucket-to-delete
  • Object Name: (from loop item)

Step 3: Delete Bucket

  • Bucket Name: my-bucket-to-delete

Handling Versioned Buckets

For buckets with versioning enabled, you must delete all object versions:

  1. List all object versions (including delete markers)
  2. Delete each version individually, specifying the version ID
  3. Delete the bucket once all versions are removed

Direct Credentials Example

You can also delete a bucket without using the Connect node:

Inputs:

  • Bucket Name: my-temporary-bucket

Options:

  • End Point: s3.us-west-2.amazonaws.com
  • Access Key Id: (your AWS Access Key ID credential)
  • Secret Key Access: (your AWS Secret Access Key credential)

Common Errors

Error: "The bucket you tried to delete is not empty"

  • Solution: Delete all objects in the bucket first, including all versions if versioning is enabled

Error: "NoSuchBucket: The specified bucket does not exist"

  • Solution: Verify the bucket name is correct and that the bucket exists in your account

Error: "Access Denied"

  • Solution: Ensure your credentials have the s3:DeleteBucket permission

Error: "BucketNotEmpty"

  • Solution: Check for delete markers and object versions if versioning was ever enabled on the bucket