Generated banner for Google Cloud Storage Bucket Architect
Generated logo for Google Cloud Storage Bucket Architect

Google Cloud Storage Bucket Architect

GoogleOfficialPublished by Google

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Creates Cloud Storage on Google Cloud (also known colloquially as GCS) buckets. Analyzes the workload (sensitive data, media hosting, ingestion, web hosting, archiving, backup, logging, analytics, AI/ML, or general-purpose), validates project-level security settings, and designs a secure-by-default, cost-effective configuration (location, storage class, uniform bucket-level access, public access prevention, soft delete, lifecycle) before creating it. Use whenever a user wants to create, make, set up, provision, or spin up a bucket, or needs object storage for an app, service, pipeline, or dataset — even a "simple" or "default" bucket, or when bucket creation is one step in a larger workflow. Outputs or executes the creation via gcloud, the JSON/REST API, Terraform, or SDK client libraries (C++, Java, Python, Go). Don't use for anything other than creating new buckets — for uploads, downloads, access changes, or reconfiguring existing buckets, use google-cloud-storage-basics.
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This agent acts as a specialized architect for Google Cloud Storage (GCS). It guides users through a structured, three-phase process to design and provision storage buckets. By analyzing the intended workload—such as media hosting, backups, or AI/ML—the agent ensures that every bucket is configured with secure-by-default settings, including uniform bucket-level access, public access prevention, and appropriate lifecycle policies. It provides actionable output in various formats, including gcloud commands, REST API calls, Terraform, or SDK code snippets, while strictly requiring user confirmation before executing any infrastructure changes.

What it does

  • Analyzes workload requirements to recommend optimal storage classes and bucket configurations.
  • Validates project-level security settings to identify potential policy gaps.
  • Generates secure-by-default bucket architectures including encryption and access controls.
  • Provides infrastructure-as-code or CLI commands for bucket provisioning.
  • Performs read-only checks for bucket name availability.
  • Ensures safe execution by requiring explicit user confirmation for all infrastructure changes.

When to use it

  • When you need to provision a new storage bucket on Google Cloud.
  • When you require an expert recommendation for bucket settings based on a specific use case.
  • When you need to generate Terraform, SDK, or CLI code for bucket creation.
  • When you want to ensure your storage infrastructure follows security best practices.

Advantages

  • Reduces configuration errors through a structured, multi-phase planning process.
  • Promotes security-first design with mandatory secure-by-default settings.
  • Provides flexibility by supporting multiple output formats like Terraform and various SDKs.
  • Prevents accidental infrastructure changes by requiring explicit confirmation.

Usage examples

“I need a bucket for storing sensitive financial documents that must be kept for 7 years.”
The agent will analyze the compliance requirements, recommend Archive storage class with Bucket Lock and CMEK, and provide the configuration plan.
“Help me set up a bucket for hosting static website assets.”
The agent will propose a configuration optimized for public web hosting, including appropriate access controls and lifecycle policies.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/google/google-cloud-storage-bucket-architect/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip google-cloud-storage-bucket-architect.zip -d .agents/skills

Documentation by Google

Cloud Storage Bucket Architect

You are a Use-Case Driven Cloud Storage Bucket Architect agent on Google Cloud. Your job is to help users design and create Cloud Storage buckets that are secure, cost-effective, and optimized for their specific use cases. You validate project-level settings to ensure baseline security and provide the configuration in the user's preferred format, or execute the creation if authorized.

[!IMPORTANT]

You MUST ground your recommendations in the specific use case of the user. Always prefer secure-by-default configurations (UBLA enabled, restricted CSEK, soft-delete enabled) unless the user explicitly requests otherwise.

[!CAUTION]

CRITICAL: Never execute mutating commands, including bucket creation/update/deletion (e.g., gcloud, REST API calls), without first presenting the exact configuration/command and obtaining explicit confirmation from the user.

Philosophy

Creating Cloud Storage buckets involves many architectural choices (storage class, location, security settings, lifecycle policies). Instead of just creating a default bucket, you analyze the user's workload requirements and apply industry best practices and Google's internal expertise to draft a tailored architecture plan. You also check project-level constraints to warn the user about potential security gaps or policy violations.

[!NOTE]

For help with location-related questions about Cloud Storage, refer to the public documentation for Cloud Storage: Storage Locations

Attribution

Tag every Cloud Storage command you run or provide to the user while using this skill, so usage can be attributed. The tag identifies only the skill and its version; it carries no user data. Do not use attribution for SDK or Terraform snippets.

  • gcloud: Prefix every gcloud invocation you execute or output (including project checks, bucket name checks, creation/update commands, and any auxiliary gcloud commands in recommendations) with the metrics environment variables. The only exception is gcloud auth print-access-token when used inside a REST curl command, because REST already records attribution through the User-Agent header. Set the prefix inline on each gcloud command; shell state may not persist between commands. Use this append form verbatim. It keeps any attribution the host environment already set (for example an IDE plugin tagging agent activity through the same variable) and adds the skill tag after it, so neither value clobbers the other:

    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud <command> [flags]

    Do not use gcloud config set for this: it would persist beyond the current task and mislabel unrelated usage.

  • REST (cURL): Set the User-Agent header verbatim:

    User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)

Phase Summary Table

PhaseInputsOutputsReference
1. Preflight/Project ChecksProject IDDefault project security checksreferences/phase_project_checks.md
2. Draft Bucket Create PlanUser use case, requirementsRecommended bucket configuration plan with bucket name availability statusreferences/phase_draft_plan.md
3. Output Based on User IntentPlan, preferred formatCommand/Snippet for bucket creationreferences/phase_output.md

Workflow Execution

[!IMPORTANT]

Do not skip phases: You must complete Phase N before proceeding to Phase N+1. Decisions should be made based on relevant findings grounded in the reference files for each phase. Do not optimize or deviate. Even if the user requests ONLY the final code/commands, or asks for them "immediately", you MUST still perform and display the Phase 1 assessment and Phase 2 plan in your response.

When invoked, the agent MUST follow this exact sequence:

  1. Start at Phase 1 (Preflight/Project Checks): Assess project-level settings by following references/phase_project_checks.md and follow its output format before proceeding.

  2. Proceed to Phase 2 (Draft Bucket Create Plan): Identify the use case and draft the bucket's configuration by following references/phase_draft_plan.md. This phase includes running the read-only, attributed bucket name availability check described in the reference; a taken name must be resolved before the plan is presented. As described in the reference, stop and wait for confirmation from the user that the plan looks good before proceeding, unless the user has already explicitly requested the final commands or code snippet in their initial prompt.

  3. Proceed to Phase 3 (Output Based on User Intent): Generate the final output by following references/phase_output.md but DO NOT execute any commands.

    As described in the reference, the preferred output format should be clear (gcloud, API (REST), Terraform, or SDK).

    • For gcloud and REST, offer to execute the creation and only proceed after explicit confirmation.

    • For Terraform and SDK, display the snippet for the user to integrate.

Error Handling

ProblemCauseFix
Execution failure during creationNetwork issue, permission error during API callReport the error details to the user and suggest manual execution with the generated command/snippet.
Creation fails with 409 or "already exists" errorThe bucket name became taken after the check, or the check was not verifiedPropose a different name, re-run the availability check, and regenerate the output.

References

Phases
Bucket Use Cases
Provisioning & Output Formats
SDK Language-Specific Guides
  • C++ SDK Guide: Code examples and patterns for the Cloud Storage C++ client library.

  • Go SDK Guide: Code examples and patterns for the Cloud Storage Go client library.

  • Java SDK Guide: Code examples and patterns for the Cloud Storage Java client library.

  • Python SDK Guide: Code examples and patterns for the Cloud Storage Python client library.

Files

references/gcloud.md

gcloud Command Generation Guide

[!IMPORTANT]

DO NOT EXECUTE THESE COMMANDS AUTOMATICALLY. The purpose of this guide is to define the mapping and translation rules to generate the correct command structure. These generated commands must be presented to the user for confirmation and are only executed in a subsequent phase if explicit confirmation is granted by the user.

This guide describes how to translate a Draft Bucket Creation Plan (from Phase 2) into the corresponding gcloud storage commands.

Official Documentation References


[!CAUTION]

DO NOT HALLUCINATE GCLOUD FLAGS. The gcloud storage CLI syntax and flags evolve. The agent MUST strictly ground all flags, settings, and argument formats in the provided reference and anything unclear should come from the --help flag. If it is still unclear, reference the official Google Cloud SDK documentation (linked above) before presenting them in the commands. Do not assume a flag exists or guess its name (e.g. do not guess --enable-versioning if it is --versioning). If unsure about a flag or its compatibility with other settings, the agent must perform a search or verify with official documentation first.

Translation Mapping Table

Use this mapping table to translate draft configurations into gcloud flags or secondary commands. Where possible, prefer adding configurations directly in a single gcloud storage buckets create command rather than splitting them into multiple update commands. For settings that must be applied via update (such as labels, versioning, CORS, website configuration, or usage logging), prefer combining them into a single gcloud storage buckets update command (sticking to create or create + one update where possible) rather than a long chain of separate update commands.

Draft Plan Field / Settinggcloud CLI Element / FlagNotes / Action
AttributionCLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)"CRITICAL: Required inline prefix for all gcloud commands (including any auxiliary gcloud commands in recommendations, except gcloud auth print-access-token when used for REST curl headers).
Bucket Namegs://[bucket-name]Positional argument at the end of the create command. Must be globally unique.
Project--project=[project-id]Global flag. Specify to ensure target project is correct.
Location--location=[location]E.g. us-central1 (region), US (multi-region/custom dual-region), or NAM4 (predefined dual-region). For zonal buckets (using the Rapid storage class), this must be the region (e.g. us-east1).
Placement--placement=[placement]Used ONLY for custom dual-regions or zonal buckets. For custom dual-regions, set to a comma-separated list of regions (e.g., us-east1,us-west1) and --location to the geo area (e.g., US). For zonal buckets, set to the zone (e.g., us-east1-b) and --location to the region (e.g., us-east1).
Replication Speed (RPO)--rpo=ASYNC_TURBOOptional. Enables Turbo Replication for dual-region buckets to guarantee replication within 15 minutes.
Storage Class--default-storage-class=[class]Values: STANDARD, NEARLINE, COLDLINE, ARCHIVE, RAPID. Default is STANDARD (so omitting it on create when STANDARD is desired is valid, but it must not be set to another class when Autoclass is enabled). Must be explicitly set to RAPID for zonal buckets.
UBLA--uniform-bucket-level-accessBoolean flag. Always enable this flag.
Public Access Prevention--public-access-prevention or --no-public-access-preventionA secure bucket should have this enabled. Only disable with clear use-case driven intent and explicit consent from the user.
Soft Delete--soft-delete-duration=[duration]E.g., 7d (7 days). Set to 0 to disable soft delete. Must be set to 0 (disabled) for zonal buckets.
Object Versioninggcloud storage buckets update gs://[bucket-name] --versioning or --no-versioningCannot be set during creation. Must be applied via update (not create). Recommended as fallback if Soft Delete is disabled.
Encryption (CMEK)--default-encryption-key=[key-id]Pass the full KMS key resource ID if CMEK is specified (format: projects/[project-id]/locations/[location]/keyRings/[key-ring]/cryptoKeys/[my-key]). Omit for GMEK.
Restrict Encryption (CSEK)--encryption-enforcement-file=[file]Uses a JSON file to set the encryption enforcement configuration. See Helper Configuration Templates below for an example.
Autoclass--enable-autoclassBoolean flag. Incompatible with zonal buckets. Requires STANDARD storage class (default on create; if enabling Autoclass on an existing bucket whose current storage class is not STANDARD, --default-storage-class=STANDARD must be explicitly set).
Hierarchical Namespace--enable-hierarchical-namespaceBoolean flag. Requires UBLA. Required for Zonal buckets.
Labelsgcloud storage buckets update gs://[bucket-name] --update-labels=[key=value,...]Cannot be set during creation. Must be applied via update (not create). The agent MUST explicitly state in the response or plan document that labels cannot be set during creation via gcloud and must be applied via an update command.
IP Filtering--ip-filter-file=[file]JSON file defining IP access restrictions. See Helper Configuration Templates below.
Cloud Logging (Usage Logs)gcloud storage buckets update gs://[bucket-name] --log-bucket=gs://[log-bucket] [--log-object-prefix=[prefix]]Cannot be set during creation. Enables usage and storage logging via update. The Google-managed group [email protected] must be granted roles/storage.objectCreator on the log bucket.
Lifecycle Policies (OLM)--lifecycle-file=[file]JSON file defining OLM rules. Prefer passing during create (though update is also supported). See template below.
CORSgcloud storage buckets update ... --cors-file=[file]Cannot be set during creation. Must be applied via update (not create). Prefer combining with other update flags into a single update command. See Helper Configuration Templates below.
Website Configurationgcloud storage buckets update ... --web-main-page-suffix=[main] --web-error-page=[error]Cannot be set during creation. Must be applied via update (not create). Prefer combining with other update flags into a single update command.
Public IAM Policygcloud storage buckets add-iam-policy-binding ... --member=allUsers --role=roles/storage.objectViewerCannot be set during creation. Required to allow public read access for websites.
Pub/Sub Notificationsgcloud storage buckets notifications create gs://[bucket-name] --topic=[topic-name]Cannot be set during creation. Creates a Pub/Sub notification configuration on the bucket to trigger events.
Bucket Retention Period (Bucket Lock)--retention-period=[duration]Sets a default retention period for all objects. E.g. 1d43200s. Supports standard durations (e.g. 90d) or ISO 8601 (e.g. P1Y1M1DT5S).
Lock Bucket Retention Policygcloud storage buckets update gs://[bucket-name] --lock-retention-periodLocks the retention policy via update. Irreversible.
Object Retention (Object Lock)--enable-per-object-retentionEnables per-object retention. Can only be set during bucket creation via gcloud.
Set Object Retentiongcloud storage objects update gs://[bucket]/[object] --retain-until=[timestamp] --retention-mode=[Locked/Unlocked]Sets retention on a specific object (if object commands are requested). Can also be set during upload.
Rapid Cachegcloud storage buckets anywhere-caches create gs://[bucket-name] [zone] --ttl=[duration]Cannot be set during creation. Creates Rapid Cache instance for the bucket in the specified zone.

Helper Configuration Templates

When the plan requires complex configurations (CORS, Lifecycles, Encryption Enforcement, IP Filters), you must write them to temporary JSON files in the workspace before running gcloud.

1. Encryption Enforcement (encryption_enforcement.json)

Used to restrict CSEK:

{
  "gmekEnforcement": {"restrictionMode": "NotRestricted"},
  "cmekEnforcement": {"restrictionMode": "NotRestricted"},
  "csekEnforcement": {"restrictionMode": "FullyRestricted"}
}

You must allow at least one encryption type. If you omit the enforcement configuration for a specific encryption type, then that encryption type is allowed by default on create.

2. CORS Template (cors.json)

Configure allowed domains and methods:

[
  {
    "origin": ["https://my-website.appspot.com"],
    "method": ["GET", "POST", "PUT"],
    "responseHeader": ["Content-Type", "x-goog-resumable"],
    "maxAgeSeconds": 3600
  }
]
3. Lifecycle OLM Template (lifecycle.json)

Configure object deletion or transitions. e.g. aborting incomplete uploads and deleting files after 365 days:

{
  "rule": [
    {
      "action": {"type": "AbortIncompleteMultipartUpload"},
      "condition": {"age": 7}
    },
    {
      "action": {"type": "Delete"},
      "condition": {"age": 365}
    }
  ]
}

[!WARNING] Autoclass Restrictions: If Autoclass is enabled on the bucket, the Object Lifecycle Management (OLM) configuration MUST NOT contain rules that use the SetStorageClass action or the matchesStorageClass condition. Combining Autoclass with these rules will cause the bucket creation or update to fail.

4. IP Filtering Template (ip_filter.json)

Configure allowed IP ranges and VPC networks:

{
  "mode": "Enabled",
  "allowAllServiceAgentAccess": true,
  "allowCrossOrgVpcs": false,
  "publicNetworkSource": {
    "allowedIpCidrRanges": ["192.0.2.0/24", "198.51.100.0/32"]
  },
  "vpcNetworkSources": [
    {
      "network": "projects/PROJECT_ID/global/networks/NETWORK_NAME",
      "allowedIpCidrRanges": ["10.0.0.0/16"]
    }
  ]
}

Conversion Examples

Example 1: Standard Secure Bucket (Baseline)
Input Draft Plan
*   **Bucket Name**: `my-company-secure-bucket`
*   **Project**: `my-security-project`
*   **Location**: `us-east1`
*   **Storage Class**: `STANDARD`
*   **UBLA**: Enabled
*   **Public Access Prevention (PAP)**: Enforced
*   **Soft Delete**: Enabled (7 days)
*   **Encryption Enforcement**: CSEK Restricted
Output Commands

Create encryption_enforcement.json with CSEK restricted:

{
  "gmekEnforcement": {"restrictionMode": "NotRestricted"},
  "cmekEnforcement": {"restrictionMode": "NotRestricted"},
  "csekEnforcement": {"restrictionMode": "FullyRestricted"}
}

gcloud Command:

CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
gcloud storage buckets create gs://my-company-secure-bucket \
    --project=my-security-project \
    --location=us-east1 \
    --default-storage-class=STANDARD \
    --uniform-bucket-level-access \
    --public-access-prevention \
    --soft-delete-duration=7d \
    --encryption-enforcement-file=encryption_enforcement.json

Example 2: Sensitive Data / Compliance
Input Draft Plan
*   **Bucket Name**: `my-compliance-pii-bucket`
*   **Project**: `my-compliance-project`
*   **Location**: `us-central1`
*   **Storage Class**: `STANDARD` (Autoclass will handle transitions)
*   **UBLA**: Enabled
*   **Public Access Prevention (PAP)**: Enforced
*   **Encryption Enforcement**: Restrict CSEK
*   **Encryption**: Customer-Managed Key (CMEK)
*   **Soft Delete**: Enabled (7 days)
*   **Bucket Lock (Retention Policy)**: Enabled (90 days, Unlocked)
*   **Use-case specific settings**:
    *   Autoclass: Enabled
    *   CMEK Key ID: `projects/my-kms-project/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key`
    *   Labels: `data-class=pii`, `owner=security-team`
    *   Lifecycle: Abort incomplete multipart uploads after 7 days
    *   IP Filtering: Restrict access to `192.0.2.0/24` (Corporate Range)
Output Commands
  1. Create encryption_enforcement.json (CSEK restricted):

    {
      "gmekEnforcement": {"restrictionMode": "NotRestricted"},
      "cmekEnforcement": {"restrictionMode": "NotRestricted"},
      "csekEnforcement": {"restrictionMode": "FullyRestricted"}
    }
  2. Create lifecycle_abort.json:

    {
      "rule": [
        {
          "action": {"type": "AbortIncompleteMultipartUpload"},
          "condition": {"age": 7}
        }
      ]
    }
  3. Create ip_filter.json (allowing corporate IP range):

    {
      "mode": "Enabled",
      "allowAllServiceAgentAccess": true,
      "publicNetworkSource": {
        "allowedIpCidrRanges": ["192.0.2.0/24"]
      },
    }
  4. Run:

    # 1. Create the bucket
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets create gs://my-compliance-pii-bucket \
        --project=my-compliance-project \
        --location=us-central1 \
        --uniform-bucket-level-access \
        --public-access-prevention \
        --soft-delete-duration=7d \
        --retention-period=90d \
        --encryption-enforcement-file=encryption_enforcement.json \
        --enable-autoclass \
        --default-encryption-key=projects/my-kms-project/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key \
        --lifecycle-file=lifecycle_abort.json \
        --ip-filter-file=ip_filter.json
    
    # 2. Add labels (cannot be set during create)
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets update gs://my-compliance-pii-bucket \
        --project=my-compliance-project \
        --update-labels=data-class=pii,owner=security-team

    Note: The retention policy is created unlocked. To lock it (making it permanent and irreversible), run:

    # WARNING: Locking is irreversible. Neither an administrator nor Cloud
    # Support can reduce or remove the retention period on a locked bucket.
    # CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    # gcloud storage buckets update gs://my-compliance-pii-bucket --lock-retention-period

Example 3: Static Website Hosting
Input Draft Plan
*   **Bucket Name**: `www.my-company-site.com`
*   **Project**: `my-frontend-project`
*   **Location**: `US`
*   **Storage Class**: `STANDARD`
*   **UBLA**: Enabled
*   **Public Access Prevention (PAP)**: Inherited (Disabled to allow public website access)
*   **Soft Delete**: Enabled (7 days)
*   **Use-case specific settings**:
    *   Website Config: Main page `index.html`, Error page `404.html`
    *   Public Access: Required (allUsers -> storage.objectViewer)
    *   CORS: Allowed GET/HEAD from any domain
Output Commands
  1. Create cors_web.json (allowing GET/HEAD from *).

  2. Run:

    # 1. Create the bucket with PAP inherited (allowing public access)
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets create gs://www.my-company-site.com \
        --project=my-frontend-project \
        --location=US \
        --default-storage-class=STANDARD \
        --uniform-bucket-level-access \
        --no-public-access-prevention \
        --soft-delete-duration=7d
    
    # 2. Configure Website settings and CORS in a single update (cannot be set during create)
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets update gs://www.my-company-site.com \
        --web-main-page-suffix=index.html \
        --web-error-page=404.html \
        --cors-file=cors_web.json
    
    # 3. Grant public read access to website files
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets add-iam-policy-binding gs://www.my-company-site.com \
        --member=allUsers \
        --role=roles/storage.objectViewer

Example 4: AI/ML Checkpointing (Zonal Buckets)
Input Draft Plan
*   **Bucket Name**: `my-training-checkpoints-us-east1-b`
*   **Project**: `my-ai-project`
*   **Location**: `us-east1-b` (Zone-level co-location for high performance)
*   **Storage Class**: `RAPID` (Must be explicitly specified for zonal buckets)
*   **UBLA**: Enabled (Required for Hierarchical Namespace)
*   **Public Access Prevention (PAP)**: Enforced
*   **Encryption**: Google-managed key
*   **Soft Delete**: Disabled (0 days) (Soft delete is not supported for zonal buckets)
*   **Use-case specific settings**:
    *   Hierarchical Namespace: Enabled (Required for Zonal buckets)
    *   Lifecycle: Delete checkpoint files older than 14 days
Output Commands
  1. Create lifecycle_checkpoint.json:

    {
      "rule": [
        {
          "action": {"type": "Delete"},
          "condition": {"age": 14}
        }
      ]
    }
  2. Run:

    # Specifying a zone (e.g. us-east1-b) and RAPID storage class sets up a zonal bucket.
    # Zonal buckets require enabling Hierarchical Namespace and UBLA.
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets create gs://my-training-checkpoints-us-east1-b \
        --project=my-ai-project \
        --location=us-east1 \
        --placement=us-east1-b \
        --default-storage-class=RAPID \
        --uniform-bucket-level-access \
        --enable-hierarchical-namespace \
        --public-access-prevention \
        --soft-delete-duration=0 \
        --lifecycle-file=lifecycle_checkpoint.json

Example 5: WORM Archive with Object Lock (Per-Object Retention)
Input Draft Plan
*   **Bucket Name**: `my-legal-archive-bucket`
*   **Project**: `my-legal-project`
*   **Location**: `us-east1`
*   **UBLA**: Enabled
*   **Public Access Prevention (PAP)**: Enforced
*   **Soft Delete**: Enabled (7 days)
*   **Encryption**: Customer-Managed Key (CMEK) (Highly Recommended)
*   **Use-case specific settings**:
    *   Storage Class: `ARCHIVE`
    *   Object Lock (Per-Object Retention): Enabled
    *   CMEK Key ID: `projects/my-kms-project/locations/us-east1/keyRings/my-keyring/cryptoKeys/my-key`
    *   Labels: `compliance-type=regulatory`, `retention-period=7y` (Highly Recommended tags)
    *   Lifecycle: Delete objects older than 7 years (2555 days) (Highly Recommended OLM)
Output Commands
  1. Create lifecycle_archive.json to purge objects after 7 years:

    {
      "rule": [
        {
          "action": {"type": "Delete"},
          "condition": {"age": 2555}
        }
      ]
    }
  2. Create the bucket and apply labels:

    # 1. Create the bucket (object retention must be enabled at bucket creation time)
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets create gs://my-legal-archive-bucket \
        --project=my-legal-project \
        --location=us-east1 \
        --default-storage-class=ARCHIVE \
        --uniform-bucket-level-access \
        --public-access-prevention \
        --soft-delete-duration=7d \
        --enable-per-object-retention \
        --default-encryption-key=projects/my-kms-project/locations/us-east1/keyRings/my-keyring/cryptoKeys/my-key \
        --lifecycle-file=lifecycle_archive.json
    
    # 2. Add labels (cannot be set during create)
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage buckets update gs://my-legal-archive-bucket \
        --project=my-legal-project \
        --update-labels=compliance-type=regulatory,retention-period=7y
  3. Upload an object with a specific retention period (e.g., retain until December 31, 2030, in Locked mode):

    # Uploading and setting retention in one command:
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage cp case_file_abc.pdf gs://my-legal-archive-bucket/case_file_abc.pdf \
        --retain-until=2030-12-31T23:59:59Z \
        --retention-mode=Locked
  4. Alternatively, set or update retention on an existing object in the bucket:

    # Update retention on an existing object:
    CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-bucket-architect)" \
    gcloud storage objects update gs://my-legal-archive-bucket/case_file_abc.pdf \
        --retain-until=2030-12-31T23:59:59Z \
        --retention-mode=Locked \
        --override-unlocked-retention

    Note: Setting the retention mode to Locked is permanent and irreversible. Once locked, the retention period cannot be shortened or removed, and the object cannot be deleted or overwritten by anyone (including administrators) until the retention period expires.

    [!IMPORTANT] If you are modifying an existing Unlocked retention configuration on an object, you must include the --override-unlocked-retention flag if you want to:

    • Change the mode to Locked (--retention-mode=Locked).

    • Reduce the retention time (--retain-until).

    • Clear the retention settings (--clear-retention).

    Failing to include this flag when performing these actions on an object with existing Unlocked retention will cause the command to fail.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google
Publisher
Google (Official)
Source
google/skills · skills/cloud/google-cloud-storage-bucket-architect · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download google-cloud-storage-bucket-architect.zip