Introduction
The Go Cloud Development Kit (Go CDK) is an open-source library by Google that provides a set of portable, idiomatic Go packages for accessing common cloud services. Rather than importing provider-specific SDKs, developers write against a single API and swap the backing service through URL-based configuration. This eliminates vendor lock-in and makes multi-cloud or hybrid deployments straightforward.
What Go CDK Does
- Provides a unified blob storage API compatible with S3, GCS, Azure Blob, and local filesystem
- Offers portable pub/sub messaging across AWS SNS/SQS, GCP Pub/Sub, Azure Service Bus, and NATS
- Abstracts document and SQL database access with pluggable drivers
- Manages secrets and configuration through a portable secrets API supporting KMS, Vault, and local keys
- Enables URL-based service construction for runtime configuration without code changes
Architecture Overview
Go CDK follows a driver-provider pattern. Each package (blob, pubsub, docstore, secrets) defines a portable API and a driver interface. Provider-specific implementations register themselves via blank imports. Services are opened using URLs like s3://bucket-name or gs://bucket-name, making it possible to change cloud providers through configuration alone. The library handles connection pooling, retries, and serialization internally.
Self-Hosting & Configuration
- Install packages with
go get gocloud.devand import the desired portable APIs - Register cloud providers via blank imports (e.g.,
_ "gocloud.dev/blob/s3blob") - Open resources using URL strings:
blob.OpenBucket(ctx, "s3://my-bucket?region=us-east-1") - Use environment variables or the standard AWS/GCP credential chains for authentication
- Run against local emulators or file-based backends during development
Key Features
- Single API surface for blob, pubsub, docstore, secrets, and server infrastructure
- URL-based resource construction enables configuration-driven cloud provider selection
- Full support for AWS, GCP, Azure, and local/on-prem backends
- Idiomatic Go interfaces with context support, iterators, and error handling
- Maintained by Google with contributions from the Go community
Comparison with Similar Tools
- AWS SDK for Go — Provider-specific; Go CDK abstracts across multiple clouds
- Pulumi/Terraform — Infrastructure provisioning tools; Go CDK is a runtime library for application code
- Dapr — Sidecar-based runtime abstraction; Go CDK is an in-process Go library with no sidecar
- Apache Libcloud — Python multi-cloud library; Go CDK serves the same role for the Go ecosystem
- CloudEvents SDK — Focused on event format standardization; Go CDK covers broader cloud service abstraction
FAQ
Q: Does Go CDK support all cloud services? A: Go CDK focuses on the most common portable services: blob storage, pub/sub, document stores, SQL databases, and secrets. It does not wrap every cloud-specific API.
Q: Can I use Go CDK with on-premise infrastructure? A: Yes. Drivers exist for local filesystem (blob), in-memory (pubsub), HashiCorp Vault (secrets), and other self-hosted backends.
Q: How does URL-based opening work?
A: Register a driver via blank import, then call blob.OpenBucket(ctx, "s3://bucket"). The URL scheme selects the driver at runtime.
Q: Is Go CDK production-ready? A: Yes. The core APIs (blob, pubsub, docstore) are stable and used in production by Google and other organizations.