Skip to main content

Create Bucket

Creates a new storage bucket in Google Cloud Storage with configurable access control, storage class, and labels.

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.
  • Project Id - The Google Cloud project ID where the bucket will be created.
  • Bucket Name - The globally unique name for the new bucket.

Options

  • Labels - Array of key-value pairs to label the bucket for organization and cost tracking.
  • Access Control Type - Bucket access control model:
    • Uniform - Uniform bucket-level access (recommended, IAM-only)
    • Fine-grained - Object-level ACLs enabled
  • Storage Class - Storage class for the bucket:
    • Standard - Frequently accessed data, best performance
    • Nearline - Accessed < once/month, 30-day minimum
    • Coldline - Accessed < once/quarter, 90-day minimum
    • Archive - Accessed < once/year, 365-day minimum
  • Credentials - Google Cloud service account credentials (optional).

How It Works

The Create Bucket node creates a new GCS bucket. When executed, the node:

  1. Establishes connection using either GCS Client Id or credentials
  2. Validates Project Id and Bucket Name
  3. Configures bucket attributes (access control, storage class, labels)
  4. Creates the bucket in the specified project
  5. Returns success once bucket is created

Example

Basic Bucket Creation

// Input:
// Project Id: "my-gcp-project"
// Bucket Name: "my-app-data-2024"
// Storage Class: Standard
// Access Control Type: Uniform

// Creates a standard bucket with uniform access control

Bucket with Labels

// In JavaScript node before Create Bucket:
message.labels = [
{ key: "environment", value: "production" },
{ key: "team", value: "data-engineering" },
{ key: "cost-center", value: "engineering" }
];

// Then use Create Bucket node with Labels option
// This helps with cost tracking and organization

Archive Bucket

// Create a bucket for long-term archival
// Input:
// Bucket Name: "company-archives-2024"
// Storage Class: Archive
// Access Control Type: Uniform

// Lowest cost storage for rarely accessed data

Requirements

  • Either valid GCS Client Id OR credentials provided directly
  • Valid Google Cloud Project ID
  • Globally unique bucket name
  • Appropriate IAM permissions:
    • storage.buckets.create permission
    • roles/storage.admin role
  • Project must have Cloud Storage API enabled

Bucket Naming Rules

  • Must be 3-63 characters long
  • Only lowercase letters, numbers, dashes, underscores, dots
  • Must start and end with number or letter
  • Cannot contain "google" or close misspellings
  • Cannot be formatted as IP address (e.g., 192.168.1.1)
  • Must be globally unique across all GCS
  • Use DNS-compatible names for best compatibility

Error Handling

Error CodeDescription
ErrInvalidArgProject Id or Bucket Name is empty/invalid

Common error scenarios:

  • Bucket name already exists (globally)
  • Invalid bucket name format
  • Project ID doesn't exist or is invalid
  • Insufficient permissions to create buckets
  • Project billing not enabled
  • API quota exceeded

Usage Notes

  • Bucket names are globally unique across all GCS users
  • Choose storage class based on access frequency and cost
  • Uniform access control is recommended for most use cases
  • Storage class affects pricing and minimum storage duration
  • Labels are useful for cost allocation and filtering
  • Default location is based on project settings (usually US multi-region)
  • Some properties cannot be changed after creation

Tips for Effective Use

  • Use descriptive, meaningful bucket names
  • Include date or version in name for time-based buckets
  • Apply labels for cost tracking and organization
  • Choose appropriate storage class to optimize costs
  • Use uniform access control unless fine-grained ACLs needed
  • Test bucket creation in development project first
  • Document bucket purpose and structure
  • Implement naming conventions across organization

Common Errors and Solutions

Error: "Bucket Name cannot be empty"

  • Solution: Provide a valid bucket name
  • Check variable bindings

Error: "Project Id cannot be empty"

  • Solution: Ensure project ID is correctly set
  • Verify project ID format (not project name)

Error: Bucket already exists

  • Solution: Choose a different, unique bucket name
  • Add timestamp or UUID to make name unique
  • Check if bucket was created in another project

Error: Invalid bucket name

  • Solution: Follow bucket naming rules
  • Use only lowercase letters, numbers, dashes
  • Ensure name is 3-63 characters

Permission denied

  • Solution: Grant storage.admin role to service account
  • Enable Cloud Storage API in project
  • Verify project billing is enabled

Use Cases

Application Data Storage

  • Create buckets for application data
  • Separate buckets per environment (dev, staging, prod)
  • Organize data by application or service

Backup and Archive

  • Create archive buckets for long-term storage
  • Separate backup buckets by date or type
  • Use appropriate storage class for cost optimization

Data Lake Setup

  • Create buckets for raw, processed, and curated data
  • Organize by data pipeline stage
  • Apply labels for data governance

Multi-Tenant Applications

  • Create separate buckets per customer/tenant
  • Isolate data for security and compliance
  • Apply labels for tenant identification

Cost Optimization

  • Use Nearline/Coldline for infrequent access
  • Archive old data with Archive storage class
  • Label buckets for cost allocation

Storage Class Comparison

ClassAccess FrequencyMin DurationRetrievalCost
StandardFrequentNoneInstantHigher
Nearline< 1/month30 daysInstantMedium
Coldline< 1/quarter90 daysInstantLower
Archive< 1/year365 daysInstantLowest

Choose based on your data access patterns and cost requirements.