Skip to main content

Delete Bucket

Permanently deletes an empty bucket from Google Cloud Storage.

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​

  • GCS Client Id - The client identifier obtained from the Connect node. Optional if credentials are provided directly.
  • Bucket Name - The name of the bucket to delete.

Options​

  • Credentials - Google Cloud service account credentials (optional). Use this instead of GCS Client Id for direct authentication without Connect node.

How It Works​

The Delete Bucket node removes an empty bucket from Google Cloud Storage. When executed, the node:

  1. Establishes connection using either GCS Client Id or provided credentials
  2. Validates the bucket name
  3. Attempts to delete the specified bucket
  4. Operation completes with a 10-second timeout
  5. Returns success if bucket is deleted

Example​

Delete Empty Bucket​

// After Connect node
// Input:
// Bucket Name: "temp-bucket-2024"

// Bucket must be empty before deletion

Delete Bucket After Cleanup​

// Workflow:
// 1. List Bucket Objects
// 2. Loop through objects
// 3. Delete each object
// 4. Delete Bucket (this node)

// Ensures bucket is empty before deletion

Requirements​

  • Either valid GCS Client Id OR credentials provided directly
  • Valid bucket name that exists
  • Bucket must be completely empty (no objects)
  • Appropriate IAM permissions:
    • storage.buckets.delete permission
    • roles/storage.admin role

Error Handling​

Error CodeDescription
ErrInvalidArgBucket Name is empty or invalid

Common error scenarios:

  • Bucket contains objects (not empty)
  • Bucket doesn't exist
  • Insufficient permissions
  • Operation timeout (10 seconds)

Usage Notes​

  • Bucket must be empty before deletion
  • Delete all objects first using Delete Object or List + Loop
  • Operation has 10-second timeout
  • Deletion is permanent and cannot be undone
  • Bucket name may become available for reuse after some time
  • Cannot delete buckets with object versions if versioning enabled

Tips for Effective Use​

  • Always empty bucket before attempting deletion
  • Use List Objects to verify bucket is empty
  • Implement cleanup workflow: list, delete objects, then delete bucket
  • Consider lifecycle policies instead of manual deletion
  • Test deletion workflows in non-production environment
  • Implement confirmation logic for important buckets

Common Errors and Solutions​

Error: "Bucket Name cannot be empty"

  • Solution: Provide valid bucket name

Error: Bucket is not empty

  • Solution: Delete all objects first
  • Use List Bucket Objects + Loop + Delete Object
  • Check for object versions if versioning enabled

Error: Timeout exceeded

  • Solution: Operation taking too long
  • Check network connectivity
  • Verify bucket exists

Permission denied

  • Solution: Grant storage.admin role
  • Verify service account permissions

Use Cases​

Temporary Bucket Cleanup

  • Delete temporary processing buckets
  • Clean up test buckets after automation
  • Remove staging buckets

Resource Management

  • Delete unused buckets to reduce costs
  • Clean up old project buckets
  • Remove development buckets

Automated Testing

  • Create and delete test buckets
  • Clean up after test runs
  • Reset test environments
warning

Deletion is permanent! Ensure the bucket is no longer needed and all data has been backed up or migrated before deletion.

tip

Before deleting a bucket:

  1. Verify all objects are deleted
  2. Check for object versions if versioning is enabled
  3. Ensure no dependencies on the bucket
  4. Back up any important data