GCP Storage And Databases
Details
Google Cloud delivers multiple options to retain, serve, and structure digital content or information. These solutions differ based on format, purpose, and performance needs—covering objects, blocks, files, key-value pairs, and relational entries.
1. Cloud Storage (Object-based)
Offers scalable locations for unstructured elements such as videos, pictures, or backups.
- Features: Global access, multi-regional durability, lifecycle automation.
- Example (CLI bucket creation):
gcloud storage buckets create my-archive-bucket \
--location=us-east1 \
--storage-class=NEARLINE- Upload Sample (Python):
from google.cloud import storage
client = storage.Client()
bucket = client.get_bucket('my-archive-bucket')
blob = bucket.blob('demo.txt')
Blob.upload_from_filename('localfile.txt')- Ideal Use: Hosting logs, serving web media, keeping historical records.
2. Filestore (NFS-compatible)
Supports applications needing shared file access.
- Nature: Network file system that integrates with virtual machines.
- Example (Create instance):
gcloud filestore instances create shared-fs \
--zone=us-central1-c \
--tier=STANDARD \
--file-share=name="fileshare",capacity=1TB \
--network=name="default"- Best For: Hosting CMS data, shared build directories, legacy migrations.
3. Bigtable (NoSQL, Wide-column)
Provides a horizontally scalable system built for massive structured workloads.
- Traits: Sub-millisecond latency, ideal for time-series or telemetry ingestion.
- Creation (CLI):
gcloud bigtable instances create sensor-instance \
--cluster=primary-cluster \
--cluster-zone=us-east1-b \
--display-name="Sensor Analytics"- Python Insertion Example:
from google.cloud import bigtable
client = bigtable.Client()
instance = client.instance("sensor-instance")
table = instance.table("device-data")
row_key = "device123#20250616"
row = table.direct_row(row_key)
Row.set_cell("metrics", "temperature", 24.7) row.commit()- Best Match: IoT feeds, event logs, recommendation engines.
4. Cloud SQL (Managed RDBMS)
Simplifies provisioning of MySQL, PostgreSQL, or SQL Server environments.
- Strengths: Automated patching, daily backups, encryption at rest.
- Setup Command:
gcloud sql instances create ecommerce-db \
--database-version=POSTGRES_14 \
--cpu=2 --memory=7680MB \
--region=asia-south1- Connector Sample (Python - psycopg2):
import psycopg2
conn = psycopg2.connect(
dbname="store",
user="admin",
password="pass123",
Host="34.123.45.67"
)- Fits: Inventory systems, business analytics, payment records.
5. Firestore (Document-based NoSQL)
Accommodates hierarchical JSON-like content, optimized for mobile/web apps.
- Specialties: Offline support, real-time updates, hierarchical data support.
- Code Sample (Node.js):
const {Firestore} = require('@google-cloud/firestore');
const db = new Firestore();
await db.collection('users').doc('u123').set({
username: 'alex',
verified: true
});- Preferred For: Messaging apps, user profiles, real-time UIs.
6. Cloud Spanner (Distributed SQL)
Merges traditional RDBMS benefits with elastic, multi-zone scaling.
- Capabilities: High availability, cross-region transactions, strong consistency.
- CLI Create:
gcloud spanner instances create multi-region-db \
--config=nam3 \
--description="Sales Data" \
--nodes=3- Usage: Financial ledgers, large-scale ERPs, real-time analytics.
7. Cloud Memorystore (In-memory Redis/Memcached)
Delivers volatile memory access for ultra-fast read/write operations.
- Scenario: Session storage, caching frequent queries, leaderboards.
- Provision Command:
gcloud redis instances create quick-cache \
--size=4 \
--region=us-central1 \
--tier=STANDARD_HAStorage Comparison Table
| Type | Tool | Structure | Use Style | Example Format |
|---|---|---|---|---|
| Object Store | Cloud Storage | Bucket/Blob | REST API | photo.jpg |
| File Share | Filestore | POSIX Paths | Mounted Drive | /mnt/data/index.html |
| Key-Value | Bigtable | Row/Column | SDK/CLI | sensor#id -> value |
| Relational | Cloud SQL | Tables/Rows | SQL Client | SELECT * FROM orders; |
| Document | Firestore | Nested Fields | SDK (web/mobile) | {"user": "joe"} |
| Distributed | Spanner | Relational-Scale | SQL + Partition | JOIN across regions |
| Cache | Memorystore | RAM-backed | Redis API | key -> object |
Example Use Case
Game Platform Design
- Game assets in Cloud Storage
- Player scores in Bigtable
- Chat history stored in Firestore
- Authentication sessions handled by Memorystore
- Leaderboards calculated using Spanner
Conclusion
Google Cloud offers distinct data-handling platforms, each tailored for specific formats, retrieval styles, and availability requirements. Whether managing massive logs, transactional entries, or web documents—there’s a precise solution ready to deploy.
Prefer Learning by Watching?
Watch these YouTube tutorials to understand GCP Tutorial visually:
What You'll Learn:
- 📌 GCP Database Services Tutorial | Deploy a Database on GCP | Google Cloud Platform Training | Edureka
- 📌 Google cloud storage | Google Cloud Platform Tutorial | Google Cloud Architect Training | Edureka