Google Cloud Storage Basics
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to interacting with Google Cloud Storage (GCS). It prioritizes the use of Cloud Storage MCP tools for efficient, agent-native operations while providing fallback paths to the gcloud CLI and JSON APIs for advanced configurations. It covers the full lifecycle of buckets and objects, including creation, data transfer, access control, and storage management, while ensuring proper attribution for all operations.
What it does
- Lists, creates, and manages GCS buckets and objects.
- Uploads, downloads, and streams data between local environments and GCS.
- Configures bucket access controls, storage classes, and lifecycle policies.
- Generates signed URLs and manages data protection features like versioning and locks.
- Integrates with MCP toolsets for optimized agent-based interactions.
- Provides attribution-compliant commands for gcloud and API usage.
When to use it
- When you need to perform basic CRUD operations on GCS buckets or objects.
- When you need to transfer files to or from Google Cloud Storage.
- When configuring bucket settings such as access, storage classes, or lifecycle rules.
- When you need to interact with GCS via an agent-connected MCP server.
- When you require programmatic access to GCS via client libraries or APIs.
Advantages
- Prioritizes fast, agent-native MCP tools over shell commands.
- Ensures consistent attribution for all cloud operations.
- Provides clear fallback paths for advanced features not covered by MCP.
- Includes safety guardrails for destructive operations like deletions.
- Standardizes interaction patterns across CLI, API, and client libraries.
Usage examples
- “List all buckets in my current project.”
- The agent will use the cloud-storage:list_buckets MCP tool if available, or execute the gcloud storage ls command with proper metrics attribution.
- “Upload local file data.txt to my-bucket.”
- The agent will use the cloud-storage:upload_object MCP tool to securely transfer the file to the specified bucket.
- “How do I create a new bucket in us-central1?”
- The agent will recommend using the cloud-storage:create_bucket MCP tool or provide the gcloud storage buckets create command with the required metrics environment variables.
- “Read the content of config.json from my-bucket.”
- The agent will use the cloud-storage:read_object MCP tool to retrieve and display the file content, provided it is within size limits.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/google/google-cloud-storage-basics/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip google-cloud-storage-basics.zip -d .agents/skills
Documentation by Google
Cloud Storage Basics
Cloud Storage on Google Cloud is a managed service for storing data as objects at any scale. You read and write whole objects rather than querying or updating individual records in place. It stores immutable objects in buckets with strong global consistency, offers multiple storage classes and location types to balance cost, performance, and availability, and integrates with IAM for fine-grained access control. Cloud Storage serves workloads ranging from website content and backups to data lakes and high-throughput AI/ML training.
Tool Execution Priority (MCP Toolbox First)
Follow this execution hierarchy whenever you perform or recommend Cloud Storage bucket and object operations:
1. Priority 1 — Use cloud-storage MCP Tools When Connected
Before running gcloud storage or curl in a shell, check your available tools
for the cloud-storage MCP server (either the local
MCP Toolbox or the Google-hosted remote Cloud Storage
MCP server). Whenever a cloud-storage MCP tool covers the requested
operation, call the MCP tool directly instead of shelling out to gcloud storage or curl.
Why MCP first: MCP tools are built for agents. Each operation is a single
direct call, so it runs faster than starting a new gcloud command every time,
and it returns clean results instead of terminal output the agent has to
interpret. It also doesn't need the gcloud CLI installed and signed in. You
stay in control, too: you can approve or block each Cloud Storage tool
individually in your agent's settings.
| Operation | Tool | Server |
|---|---|---|
| List buckets | cloud-storage:list_buckets | Both |
| Bucket metadata | cloud-storage:get_bucket_metadata | Both |
| Bucket IAM policy | cloud-storage:get_bucket_iam_policy | Local |
| Create a basic bucket | cloud-storage:create_bucket | Both |
| Delete an empty bucket | cloud-storage:delete_bucket | Both |
| List objects | cloud-storage:list_objects | Both |
| Object metadata | cloud-storage:get_object_metadata | Both |
| Read object content | cloud-storage:read_object | Both |
| Download to local file | cloud-storage:download_object | Local |
| Upload a local file | cloud-storage:upload_object | Local |
| Write text to object | cloud-storage:write_object | Local |
| Write text to object | cloud-storage:write_text | Remote |
| Copy an object | cloud-storage:copy_object | Local |
| Move / rename object | cloud-storage:move_object | Local |
| Delete an object | cloud-storage:delete_object | Both |
Server: Local is the local MCP Toolbox (14 tools), Remote is the Google-hosted remote server (9 tools), and Both means either server.
read_objectis capped at 8 MiB. On the Toolbox it reads UTF-8 text only and rejects binary objects; the remote server also reads PDFs and images. For binary or larger objects, usedownload_object.upload_objecthandles binary files and files larger than 8 MiB.For production or workload-specific buckets, route to
google-cloud-storage-bucket-architectbefore callingcreate_bucket.
[!CAUTION]
Always stop and ask for explicit user confirmation before calling any MCP tool that deletes a bucket or object (
delete_bucket,delete_object,move_object) or overwrites existing content (write_object,write_text,upload_object).
2. Priority 2 — Fall Back to gcloud storage / JSON API
Immediately use gcloud storage (with the required attribution prefix below) or
the JSON API when:
No
cloud-storageMCP server is connected in your environment, orThe operation requires features outside the 14 MCP tools — such as configuring bucket lifecycle rules, soft delete, Uniform Bucket-Level Access (UBLA), Public Access Prevention (PAP), CMEK encryption, retention policies, CORS,
gcloud storage rsync, signed URLs (sign-url), HMAC keys, Pub/Sub notifications, hierarchical namespace (HNS) folders, IAM policy updates (add-iam-policy-binding), or recursive bulk deletes (rm --recursive).
3. Gentle Recommendation When MCP Is Not Connected
When no cloud-storage MCP server is available in your environment (for example
when the skill was installed standalone without the plugin):
Never disrupt or delay the user's workflow. Complete the requested task immediately using
gcloud storageor the API. Never pause or ask the user to install the MCP server before answering.Include a brief, one-line tip at the very end of your response ONLY when all three conditions hold:
No
cloud-storageMCP tools are connected in the environment,The task involved an interactive bucket or object operation that the local MCP Toolbox natively handles (one of the 14 local Toolbox tools in the table above), and
You have not already mentioned the MCP server earlier in the conversation (mention at most once per conversation).
Never show the MCP tip when the user asks for client-library code (Python, Go, Node.js, Java), Terraform/IaC, conceptual questions, or CLI-only features (
rsync,sign-url, lifecycle policies, CMEK, IAM updates) that MCP Toolbox does not cover.Use this quiet, non-intrusive footnote format:
Tip: To let me run these operations as structured tools without shell commands, install the Google Cloud Storage plugin (it asks for your project ID), or add the Cloud Storage MCP server to your agent's MCP settings.
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.
Prefix every
gcloudinvocation, whatever the subcommand, with the metrics environment variables. Set them inline on each 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-basics)" \ gcloud <command> [flags]Do not use
gcloud config setfor this: it would persist beyond the current task and mislabel unrelated usage.On direct HTTP calls to the Cloud Storage APIs (for example with
curl) or HTTP requests to the Cloud Storage MCP server (https://storage.googleapis.com/storage/mcp), set this exact User-Agent header, verbatim — the collection pipeline parses thegcs-skills/<version>andskill:<name>tokens, so any rewording breaks attribution:User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)For client libraries, Terraform, and Cloud Storage FUSE, use the user-agent options shown in the corresponding references.
Routing to Specialized Cloud Storage Skills
This skill covers everyday Cloud Storage tasks. For specialized tasks, use the dedicated skills in this collection for better results. Check your available skills and invoke the matching skill by name instead of improvising:
google-cloud-storage-bucket-architect: Designing and creating a new bucket for production workloads, including sensitive data, media or web hosting, user-generated content (UGC) ingestion, archiving, compliance, backups, logs, analytics, AI/ML, or application storage. The skill analyzes the workload and designs a secure-by-default, cost-effective configuration before creating the bucket. Use the Quick Start section below only for temporary scratch buckets.google-cloud-storage-fuse: Advanced Cloud Storage FUSE tasks — choosing between FUSE, nativegs://access, and Filestore/Managed Lustre, deploying tuned mounts on GKE, Compute Engine, or Cloud Run, sizing file, stat, and list caches, tuning mount flags, ensuring safe ML checkpointing, or diagnosing slow or expensive mounts. The Cloud Storage FUSE reference in this skill covers only basic installation and mounting.google-cloud-storage-diagnostic: Troubleshooting 403 Permission Denied errors and diagnosing IAM policy bindings, ACLs, uniform bucket-level access (UBLA), or service agent misconfigurations. Ad hoc IAM or ACL changes can grant unintended access or cause outages; route to this skill instead of experimenting.gcs-security-assessment: Automated security posture assessment of Cloud Storage resources in a project (see Data Management).
If the matching skill is not installed, do not improvise. Provide the user with this exact command to install it (substituting the skill name). Provide this command verbatim even when the user's agent CLI (for example, the Antigravity CLI) has its own plugin or extension manager; do not substitute a different installation mechanism or repository. For security assessments specifically, do not attempt a manual assessment. Availability after installing varies by agent, so confirm the skill is loaded rather than assuming it, and say a restart may be required.
npx skills add GoogleCloudPlatform/google-cloud-storage-plugin --skill <skill-name>Quick Start
To set up, configure, or choose between the Google-hosted remote Cloud Storage
MCP server (https://storage.googleapis.com/storage/mcp) and the local MCP
Toolbox (cloud-storage), read MCP Usage. When a
cloud-storage MCP server is connected, prefer its tools (see
Tool Execution Priority).
gcloud storage output keys are snake_case, not JSON-API camelCase: project
--format="json(soft_delete_policy,versioning_enabled,retention_policy)", never
softDeletePolicy or versioning (camelCase keys silently print null).
Enable the Cloud Storage API:
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \ gcloud services enable storage.googleapis.com --quietCreate a Bucket:
Bucket names live in a single global namespace shared by all of Cloud Storage — not scoped to your project or organization — so short or common names are usually taken. If the location is omitted, the bucket defaults to the
USmulti-region.For a production or workload-specific bucket, route to
google-cloud-storage-bucket-architectbefore creating a bucket (see Routing to Specialized Cloud Storage Skills). The options below create a basic default bucket.Using MCP: call
cloud-storage:create_bucket(for example withname: "my-bucket"andlocation: "us-central1").Using the gcloud CLI:
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \ gcloud storage buckets create gs://my-bucket --location=us-central1Using the JSON API:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \ -H "Content-Type: application/json" \ -d '{"name": "my-bucket", "location": "US-CENTRAL1"}' \ "https://storage.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)"Upload an Object:
Using MCP: call
cloud-storage:upload_objectto upload a local file (including binary or large files), orcloud-storage:write_object(local Toolbox) /cloud-storage:write_text(remote server) to write UTF-8 text directly.Using the gcloud CLI:
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \ gcloud storage cp ./my-file.txt gs://my-bucketUsing the JSON API:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \ -H "Content-Type: text/plain" \ --data-binary @my-file.txt \ "https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=media&name=my-file.txt"Download or Read an Object:
Using MCP: call
cloud-storage:read_objectto read UTF-8 text content (up to 8 MiB), orcloud-storage:download_object(local Toolbox) to save an object, including binary or larger files, to the local filesystem.Using the gcloud CLI:
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \ gcloud storage cp gs://my-bucket/my-file.txt .Using the JSON API:
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \ "https://storage.googleapis.com/storage/v1/b/my-bucket/o/my-file.txt?alt=media"
Reference Directory
Core Concepts: Buckets, objects, folders, prefixes, bucket location types, and storage classes.
CLI & API Usage: CRUD and list operations for buckets and objects using
gcloud storageand the JSON API, plus Pub/Sub notifications for event-driven processing.Client Libraries: Using Google Cloud client libraries for Python, Java, Node.js, and Go, with pointers to all other supported languages.
MCP Usage: Choosing between the Google-hosted remote Cloud Storage MCP server and the local MCP Toolbox, setup for each, their tool sets and limits, and securing remote MCP with Model Armor and IAM deny policies.
Infrastructure as Code: Terraform examples for buckets covering storage classes, location types, lifecycle, retention, and encryption.
Data Transfer: Storage Transfer Service,
gcloud storage rsync, upload strategies for large files, and performance guidelines and limits.Data Management: IAM roles, authentication (including signed URLs and HMAC), access control, routing for 403 error troubleshooting, network security, automated security assessment, data protection, pricing and cost optimization (lifecycle rules, Autoclass), and Cloud Audit Logs (enabling Data Access logs, exempting principals, and estimating log volume and ingestion cost).
Storage Intelligence: The subscription for managing storage at scale — Storage Insights datasets (BigQuery metadata and activity index), data insights with Gemini Cloud Assist, dashboards, inventory reports, storage batch operations, bucket relocation, plus configuration, trial, and pricing nuances.
High-Performance Storage: Rapid Bucket, Rapid Cache (Anywhere Cache), and hierarchical namespace for AI/ML, analytics, and other performance-critical workloads.
Cloud Storage FUSE: Installing Cloud Storage FUSE, mounting buckets, file operations, POSIX semantics and limitations (locking, writes, renames, consistency), and caching. For advanced tuning, deployment, and diagnosis, route to the
google-cloud-storage-fuseskill.
Files
- ATTRIBUTION.mdAdded by AutoGineer852 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md17.3 KiB
- references/cli-api-usage.md7.8 KiB
- references/client-library-usage.md4.8 KiB
- references/core-concepts.md7.5 KiB
- references/data-management.md21.2 KiB
- references/data-transfer.md12.1 KiB
- references/gcsfuse.md21.6 KiB
- references/high-performance-storage.md11.2 KiB
- references/iac-usage.md9.4 KiB
- references/mcp-usage.md13.7 KiB
- references/storage-intelligence.md15.3 KiB
references/data-management.md
GCS Data Management, Security, & Cloud Audit Logs
This reference guide covers the core data management, security, and cost optimization capabilities of Google Cloud Storage (GCS). This means providing an overview of various access control, data protection, and security best practices while storing data in GCS along with relevant gcloud commands.
[!TIP] Automated Security Posture Assessment
For an automated security analysis of GCS resources in a project, use the
gcs-security-assessmentskill — never improvise a manual assessment or substitute other security products (e.g., Security Command Center). If the skill is not installed, give the user this exact command (not the CLI's own plugin or extension manager) and wait until it is installed:npx skills add GoogleCloudPlatform/google-cloud-storage-plugin --skill gcs-security-assessment
[!TIP] 403 / Permission Denied Diagnosis
To troubleshoot 403 Permission Denied errors or diagnose access-control configurations, use the
google-cloud-storage-diagnosticskill (see the "Routing to Specialized GCS Skills" section in SKILL.md). Never apply state-modifying IAM or ACL changes without explicit user approval. If the skill is not installed, give the user this exact command (not the CLI's own plugin or extension manager):npx skills add GoogleCloudPlatform/google-cloud-storage-plugin --skill google-cloud-storage-diagnostic
1. Identity and Access Management (IAM)
Cloud Storage uses IAM for access control, allowing you to grant permissions at the bucket, project, and managed-folder levels.
Predefined Roles
Assign predefined roles to enforce the principle of least privilege based on the principal's operational responsibilities:
roles/storage.admin: Grants full control over buckets and their objects. This role can be granted at the bucket-level, limiting its scope to just that bucket and its objects.roles/storage.objectAdmin: Grants full control of objects, and allows management of folders and Managed Folders, including listing, creating, viewing, and deleting them. This role can be granted at the bucket-level, limiting its scope to just that bucket's objects and folders/Managed Folders. Viewing IAM policies on Managed Folders are excluded.roles/storage.objectUser: Grants the same permissions as objectAdmin except IAM permission for reading/setting object ACLs and permission to set or override unlocked retention are excluded.roles/storage.objectViewer: Grants read-only access to object contents and metadata, excluding ACLs. This includes the ability to get/list folders and Managed Folders. It can also be scoped to a single bucket's contents.roles/storage.objectCreator: Allows users to create objects and resources like folders/Managed Folders. This does not give permission to view, delete, or overwrite objects. It can be scoped to a single bucket.roles/storage.bucketViewer: Grants permission to list buckets and their metadata, excluding IAM policies.roles/storage.folderAdmin: Grants full control over folders/Managed Folders and objects, including listing, creating, viewing, and deleting them. This role does grant access to get/set IAM policies on Managed Folders.
[!NOTE]
Roles can be combined to minimize overpermissioning for certain workflows, e.g. objectCreator/objectViewer for a read-write workflow but intentionally avoiding the delete permission granted by objectUser/objectAdmin.
Reference public documentation for other predefined Storage IAM roles not mentioned here: https://docs.cloud.google.com/storage/docs/access-control/iam-roles.
Custom IAM Roles
If predefined roles provide more permissions than necessary, you can also create
custom IAM roles containing only the specific permissions required by your
workload (e.g. bundling storage.objects.get and storage.objects.list without
granting delete permission). This enforces strict least privilege and prevents
overpermissioning in sensitive environments.
Create a custom IAM role:
gcloud iam roles create myCustomStorageRole \ --project=my-project \ --title="Custom Storage Reader" \ --description="Grants get and list permissions for GCS objects" \ --permissions=storage.objects.get,storage.objects.listList custom roles:
# View org-level custom roles gcloud iam roles list --organization=1234 # View project-level custom roles gcloud iam roles list --project=4321 # View predefined roles gcloud iam roles listInspect a custom IAM role:
gcloud iam roles describe myCustomStorageRole --project=my-project
Adding IAM Policy Bindings at Bucket Level
Use the gcloud storage CLI to bind roles to principals (users, service
accounts, or groups) at the bucket or Managed Folder level.
[!NOTE]
While project, bucket, and Managed Folder IAM policies govern the objects within them, it is not possible to set an IAM policy directly at the object level. Individual object-level permissions can only be managed using legacy Access Control Lists (ACLs), which are disabled when Uniform Bucket-Level Access is enabled. Using legacy object ACLs is not recommended.
Grant bucket-level access:
gcloud storage buckets add-iam-policy-binding gs://my-bucket \ --member="serviceAccount:[email protected]" \ --role="roles/storage.objectViewer"
2. Authentication & Authorization
GCS supports multiple authentication mechanisms tailored to different architectural boundaries and client types.
IAM Authentication
Authentication confirms identity by exchanging principal credentials—such as
user accounts (gcloud auth login) or service accounts—for short-lived OAuth
2.0 access tokens. Application Default Credentials (ADC, via gcloud auth application-default login) automatically locates these credentials across
environments. For advanced architectures, Google Cloud supports Workload
Identity Federation (for keyless multi-cloud/on-premises authentication),
Workforce Identity Federation (for external IdPs), and Service Account
Impersonation.
See the diagram on https://docs.cloud.google.com/docs/authentication#auth-decision-tree to help the user determine which authentication method is best for them.
Signed URLs (V4 Signing)
Signed URLs use signatures to give time-limited access to a specific Cloud Storage resource, granting permissions like read, write, or delete access without requiring the client to hold Google Cloud credentials or IAM roles.
The most common uses for signed URLs are uploads and downloads, because in such requests, object data moves between requesters and Cloud Storage.
[!NOTE]
Signed URLs can only be used to access Cloud Storage resources through XML API endpoints. HMAC credentials are also not supported when using Cloud Storage tools to generate signed URLs.
Generate a 15-minute signed upload URL:
gcloud storage sign-url gs://my-bucket/uploads/user-profile.png \ --duration=15m \ --impersonate-service-account=signed-url-account@my-project.iam.gserviceaccount.com \ --http-verb=PUT \ --headers=content-type=image/png
HMAC Keys
HMAC keys are a type of credential associated with an account (e.g. a service account) that allows creation of signatures included in Cloud Storage XML API requests. These are useful for allowing you to move data between other cloud storage providers and GCS because HMAC keys allow you to reuse your existing code to access Cloud Storage.
Create an HMAC key for a service account:
gcloud storage hmac create [email protected]
3. Access Control Policies
Control how permissions are evaluated and prevent accidental exposure using bucket-level access guardrails.
Uniform Bucket-Level Access (UBLA)
Uniform Bucket-Level Access disables legacy object-level Access Control Lists (ACLs) to ensure that access to the bucket and its objects is only governed by IAM.
[!NOTE]
UBLA is required for using Managed Folders, Hierarchical Namespace (HNS) buckets, and IAM conditions directly on buckets.
[!WARNING]
UBLA cannot be disabled after it has been active on a bucket for 90 consecutive days.
Enable UBLA on an existing bucket:
gcloud storage buckets update gs://my-bucket --uniform-bucket-level-access
Public Access Prevention (PAP)
Public Access Prevention explicitly blocks any public IAM bindings (such as
allUsers or allAuthenticatedUsers) on a bucket, overriding any existing
public policies. This can also be enforced at the organization level.
Enforce Public Access Prevention:
gcloud storage buckets update gs://my-bucket --public-access-prevention
4. Network Security & Perimeters
Protect storage buckets from unauthorized access and data exfiltration at the network layer.
VPC Service Controls (VPC-SC): In order to prevent unintended loss or disclosure of sensitive data and data exfiltration, VPC-SC allows you to define security policies that prevent access to Google-managed services outside of a trusted perimeter, block access to data from untrusted locations, and mitigate data exfiltration risks.
Bucket IP Filtering: Bucket-level access can be restricted through allowlisted public or private (VPC network) CIDR ranges, denying all requests from outside the range regardless of IAM status (for specific buckets).
Regional Endpoints: Binds API operations and control planes to specific geographic endpoints (e.g.,
storage.eu.rep.googleapis.com).
5. Data Protection & Immutability
GCS provides several features to help prevent compliance violations, accidental deletions, and other risk management.
Soft Delete
Soft delete retains deleted or overwritten buckets and objects for a specified duration (between 7 and 90 days) before being permanently deleted, allowing a restoration of its pre-deleted state.
[!CAUTION]
If a bucket primarily contains short-lived, temporary data, enabling soft delete can result in significantly increased storage costs. To optimize cost, objects can be renamed instead of copying and temporary data can be stored separately (e.g. in buckets with soft delete disabled).
See https://docs.cloud.google.com/storage/docs/soft-delete#soft-delete-considerations for more considerations about how Soft Delete interacts with other features.
Configure soft delete duration for a bucket:
gcloud storage buckets update gs://my-bucket --soft-delete-duration=30dRestore soft-deleted object (with generation):
gcloud storage restore gs://my-bucket/my-object#1234
If no generation is specified, the latest version will be restored.
Object Versioning
Object Versioning preserves deleted objects as versioned, noncurrent objects that remain accessible in your bucket until explicitly removed. It's recommended to consider using Object Lifecycle Management in combination with versioning as it can remove older versions of an object after a specified length of time or as newer versions become noncurrent.
[!CAUTION]
Objects can only be recovered from a deleted bucket when soft delete is enabled. Object Versioning does not provide protection against bucket deletions.
Enable object versioning:
gcloud storage buckets update gs://my-bucket --versioning
Object Retention Lock
Object Retention Lock lets you define data retention requirements on a per-object basis. This differs from Bucket Lock, which defines data retention requirements uniformly for all objects in a bucket. Enforcing retention is an irreversible action and an object's retention cannot be reduced or removed by anyone (including Google Support) until the retention period expires. This can help primarily with regulatory and compliance requirements (e.g FINRA, SEC, and CFTC) or regulations in other industries like health care.
[!NOTE]
Object retention can only be enabled on existing buckets through the Google Cloud Console UI. New buckets are supported for standard APIs.
Enable object retention on a bucket:
gcloud storage buckets create gs://my-bucket --enable-per-object-retentionApply an unlocked retention policy to an object:
gcloud storage objects update gs://my-bucket/records/data.csv \ --retention-mode=Unlocked \ --retain-until=YYYY-MM-DDT00:00:00Z
[!CAUTION]
CRITICAL: Locking an object retention policy is irreversible. Ensure your compliance timeline is absolute before locking an object.
Bucket Lock (Retention Policy)
Enforces an immutable retention policy across all objects in a bucket. Once locked, the policy cannot be deleted or shortened by anyone (including Google support) until the retention period expires, though it can be increased.
Bucket Lock can also help with regulatory and compliance requirements (FINRA, SEC, and CFTC) or regulations in other industries like health care.
Configure and lock a 100-day retention policy:
# 1. Set the retention policy gcloud storage buckets update gs://my-bucket --retention-period=100d # 2. Permanently lock the bucket (Requires explicit verification) gcloud storage buckets update gs://my-bucket --lock-retention-period
[!CAUTION] CRITICAL: Locking a bucket retention policy is irreversible. Ensure your compliance timeline is absolute before locking the bucket.
Object Holds
Object holds are metadata flags on individual objects. While the hold exists, the object cannot be deleted or replaced, though its metadata can be updated. There are two types of holds:
Temporary Holds: Objects cannot be deleted or replaced until the hold is explicitly released.
Event-Based Holds: Objects also cannot be deleted or replaced until the hold is explicitly released, but this is also used in conjunction with retention policies. A hold on an object subject to a retention policy will trigger an event which resets the retention timer as soon as the hold is released, meaning it is subject to its full retention period.
Enforce holds on an object:
# Place a temporary hold for legal investigation gcloud storage objects update gs://my-bucket/legal/case-file.pdf --temporary-hold # Place an event-based hold for event-driven retention gcloud storage objects update gs://my-bucket/contracts/loan.pdf --event-based-hold
Encryption Options
Google-Managed Encryption Keys (GMEK): Ideal for most users who need their data encrypted at rest without wanting to manage encryption keys, satisfying many compliance requirements automatically.
Customer-Managed Encryption Keys (CMEK): Allows users to control the lifecycle of encryption keys to meet specific compliance standards (e.g. PCI-DSS or HIPAA).
Customer-Supplied Encryption Keys (CSEK): Allows users to use an existing key management system outside of Google Cloud. The key is not stored within Google.
Client-Side Encryption: Ensures Google has no possible access to unencrypted data but places the full burden of key management, encryption, and decryption to the user.
6. Cost Optimization & Object Lifecycle Management
GCS provides automated features and lifecycle policies to help manage storage costs efficiently without manual intervention.
Object Lifecycle Management (OLM)
Allows users to configure a set of rules which apply to current/future objects in the bucket. When that criteria is met, Cloud Storage automatically performs a specified action on the object, for example:
Downgrade storage class to Coldline for objects older than a year.
Delete objects created before January 1st, 2019.
Keep only the 3 most recent versions of each object in a bucket with versioning enabled.
Example Lifecycle policy:
{
"lifecycle": {
"rule": [
{
"action": {"type": "Delete"},
"condition": {
"daysSinceNoncurrentTime": 7
}
}
]
}
}Apply an OLM policy using gcloud:
gcloud storage buckets update gs://my-bucket --lifecycle-file=lifecycle.json
Autoclass
Autoclass simplifies and automates cost saving for Cloud Storage data by moving data that isn't accessed to colder storage classes (reducing storage cost) and moving data that is accessed to Standard storage to optimize future accesses.
Enable Autoclass on a bucket:
gcloud storage buckets update gs://my-bucket --enable-autoclass
7. Cloud Audit Logs
Google Cloud Audit Logs provide oversight into operational and data access activities within Cloud Storage. They are broken down into two primary categories:
Admin Activity Audit Logs: Records operations that modify the configuration or metadata of a bucket or object (e.g., creating a bucket, updating IAM policies). These are enabled by default and cannot be disabled.
Data Access Audit Logs: Records API calls that read or write metadata or object data (e.g., uploading or downloading objects). These are disabled by default to manage log volume and ingestion costs.
Enabling Data Access Logs for Cloud Storage
To turn on Data Access audit logs for Cloud Storage (storage.googleapis.com),
you configure the IAM policy at the project (or folder/organization) level.
[!WARNING] High-volume Data Access logging (
DATA_READ/DATA_WRITE) can generate massive log volumes, resulting in high ingestion and storage costs. Refer to Managing Data Access Audit Log Costs below to see how to configure cost-saving exemptions.
Enable Data Access logs using gcloud:
# 1. Export the current project IAM policy gcloud projects get-iam-policy my-project > policy.yaml # 2. Append or update the auditConfigs section in policy.yaml: # auditConfigs: # - auditLogConfigs: # - logType: DATA_READ # - logType: DATA_WRITE # service: storage.googleapis.com # 3. Apply the updated IAM policy gcloud projects set-iam-policy my-project policy.yaml
Managing Data Access Audit Log Costs
To control costs, restrict service account logging:
Exempt service accounts (Recommended): Add
exemptedMembersunderauditConfigsin your IAM policy to prevent log generation:auditConfigs: - service: storage.googleapis.com auditLogConfigs: - logType: DATA_READ exemptedMembers: [ "serviceAccount:[email protected]" ] - logType: DATA_WRITE exemptedMembers: [ "serviceAccount:[email protected]" ]Exclude logs: Log Router exclusion filters discard logs after generation, which still incurs service processing load. Audit configuration is preferred.
Rates: Ingestion is $0.50/GiB (first 50 GiB/month free); storage is $0.01/GiB/month (first 30 days free).
Formula:
Monthly GiB = QPS * 2,628,000 * 1KB / 1e6 * 0.93.2,628,000: Average seconds per month.1KB: Estimated size per audit log entry.1e6: Conversion factor from KB to GB (1,000,000 KB).0.93: Factor to convert decimal GB to binary GiB.
Documentation
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.
Needs: Needs an MCP server, Needs a command-line tool, Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
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
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/google-cloud-storage-basics · 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-basics.zip