Storage in the cloud

There are different storage database solutions appart from your VMs persistent disk.

Types of data storage

Cloud Storage

Large storage for BLOBS. It stores data as a bunch of bytes and gives a unique key to address to it. This keys are often in the form of URLs. It is fully scalable.

Its objects are immutable. It encrypts the data on server-side and encrypts data being sent by HTTPS.

The files are organized into bucket that must have a globally unique name. The global variable -DEVSHELL_PROJECT_ID wich contains the project id is great for that. The bucket may be set into a region or multi-region.

There is object versioning for your buckets. If you don’t turn it on, new always override old. It offers lifecycle management policies so you don’t accumulate junk. It has a limit of 5 TBs per object.

Cloud storage types

  • Multi-regional Most frequently accessed. Content storage and delivery.
  • Regional Accessed frequently within a region. Analytics.
  • Nearline Accessed less than once a month. Backups.
  • Coldline Accessed less than once a year. Archiving; Disaster recovery.

The difference is the storage price (price per GB per month) and the retrieval price (price per GB transfered).


Relational databases vs NoSQL

Relational databases have tables in which every row has the same structure of columns and the database schema enforces this rules and others you set. This schema also helps to keep consistent data.

Relational databases may designate a group of database changes as all or nothing (transactions). Either they all get made or none do.

A more flexible aproach would be a NoSQL schema. In this situation not all the rows may have the same structure of columns.


Cloud SQL

Cloud SQL is a RDBMS (Relational database management system). It presents a MySQL or PostgreSQL interface. It is a good fit when you want the advantages of a relational database but you don’t want to spend time on administration or setting it up. It provides automatic replication between multiple zones in case a disaster occurs. It also helps setting up backup data automatically.

It may scale vertically (changing the machine type) or horizontally (by setting more read replicas). For security it includes firewalls and the data is encrypted.

They are accesible by GCP Services and external services.

Cloud Spanner

This is an alternative for when you need a lot of horizontal scalability. Also for when you have outgrown any relational database or sharding your database for high performance, transactional consistency and global data.

It can scale up to PBs of data while SQL is limited to the size of the database instances. It uses ANSI SQL 2011 with extensions.


Cloud Datastore

It is a highly scalable NoSQL database. It stores structued data from App Engine apps and parts in Compute Engine.

It automatically handles sharding and replication. It offers a free small quota.

It scales automatically to handle load. Unlike Cloud Table it also offers transactions that affect multiple database rows. SQL-like queries.

Cloud Bigtable

Cloud Bigtable is Google’s managed NoSQL, big data database service. It has great scalability without downtime.
Databases are sparsely populated tables that can scale up to PBs of data. GCP fully manages the surface so you don’t have to configure it.

it’s ideal for:

  • data that has a single lookup key
  • storing large amounts of data with very low latency
  • operational and analytical applications including IoT

Accessed through HBase API. All data is encrypted. It powers Google Search, Maps and GMail.