Introduction to GCP
Goal of this post
I would like to give a short introduction to GCP (Google Cloud Platform). It is one of the most commonly used cloud platform. As more and more IT projects are deployed to a cloud, it will be nice to see a big picture of this subject. In this post I will not go into details and specific solutions and implementations. I would like to present an overview of what GCP has to offer and how it is structured.
I will mention subjects like:
- Compute engine (GCE)
- Object Storage
- Databases
- Pricing
Of, it will not be exhaustive, and I will not be able to describe all the available services. My goal here is to give everyone a starting point and introduce basics of GCP. From that point we can go deeper and deeper. Should you have any questions, feel free to contact me.
GCE
Google Compute Engine – one of the most important Google Cloud services. It allows to create and manage virtual servers (Virtual Machines) in the cloud where we can install and run applications.
The main functionalities of GCE include:
- Running Virtual Machines
- Managing load balance
- Auto scaling
- Adding storage that will be used by apps
- Managing virtual networks and communication between VM instances
VMs types
We can choose from different VM families to be sure to select optimal instance for our needs.
- General-purpose - Balanced machine types with a good mix of CPU and memory resources.
- Compute-optimized - These machines have a higher number of virtual CPUs compared to memory, making them suitable for compute - intensive tasks.
- Memory-optimized - These machines provide more memory compared to virtual CPUs, making them suitable for memory - intensive applications.
- Accelerated computing - These machine types are designed for workloads that require high-performance GPUs or TPUs.
- Micro and Small - These are small machine types suitable for lightweight applications or testing.
Addressing
Very important subject connected with VMs is addressing. Each created instance is becoming two IP addresses. Internal and External.
- Internal IP Address - is used to communicate between instances inside Google Cloud infrastructure. It is assigned once at creation and is never changed.
- External IP Address – is used to communication with the outside world. Out instance can be called by different, external services using this address. There is one thing that we should be aware of. This IP address is not permanent. Every time our instance is restarted a new external address is being assigned to it. That forced us to find different solution when we want to assure that under the same address, we will always find the same instance.
For solving problems with changing external IP addresses we use a third type of address:
- Static IP Address – it allows us to make the external IP address of our machine immutable. That will solve our problem with external visibility and allows us to always call the same machine using a given IP address.
This has one small drawback that we should be aware of. When we assign a stat is IP to a machine, even if not started and in use, we will be charged for it and it will cost us money.
Knowing all this we can now use our VMs as normal local servers. We can SSH to them, install a software, deploy an app, start and stop.
Load balancing
Google Cloud Load Balancing allows to distribute incoming traffic across multiple VM instances in different regions. Thanks to this option, we can handle thousands and millions of requests and not overload our application. Load balancing is managed by GCP and it is auto scalable.
Google provides three types of load balancers:
- HTTP(S) load balancer
- TCP load balancer
- UDP load balancer
All of them can be internal or external. It depends on what type of usage we need. If our application is available on the Internet, we most likely will be using external load balancer. When our application is a part of internal network, we should consider internal load balancer.
UDP load balancer allows us to manage traffic on the inside one region. TCP and HTTP load balancers are one or multi region ready.
When creating a load balancer, you have to configure backends, frontend and host and path rules.
As backend, it is possible to use a managed instance group or bucket storage.
Host and path rules provide information about redirections to our backends. It is possible to configure what request types should be proceeded by specific backend configurations.
Frontend configuration sets protocol and port of incoming requests.
Load balancing can be done in one of two modes.
- Utilization - based on percentage of instances utilization.
- Rate – based on requests per second (RPS) per instance.
Auto scaling
While creating managed instance groups, we have a possibility to provide information for auto scaling mechanism.
- minimum and maximum number of instances that will be running
- metric based on what we will be scaling our application (CPU or load balancer utilization)
- Auto healing configuration - replacing unhealthy instances with healthy ones based on health check
Object storage
Block storage
It is possible to attach storage block to VM instance. Inmost cases it is only possible for one block storage to be attached to only one VM. As always, there is an exception to this rule. It is possible to create a read-only block storage. In that case, this kind of storage can be assigned to many different VMs and all of them are able to read from it.
There are two implementations of block storage inside the GCP:
- Persistent Discs - this type of storage is more like a network disk. It can be assigned to VMS started in different hosts. Thanks to that, data can be replicated in different zones
- Local SSDs - this storage is available only on the same host as VM instance
File Storage
Another type of storage available on GCP is File Storage. The main thing that differentiates it from the Block Storage is the possibility to act as shared storage for many VMs. If we create a group of instances, we can attach one File Storage to all of them to transfer data between them and allow read and write access to the file stored on it.
GCP provides only one type of File Storage:
- Filestore - high performance file storage. Provides a fully managed Network Attached Storage (NAS) service for applications that require a shared file system.
Cloud Storage
Google Cloud Storage is a scalable object storage service offered by GCP. It allows users to store and retrieve data in a highly available and durable manner. Google Cloud Storage is designed to provide developers and businesses with a reliable and cost-effective solution for storing and managing various types of data, such as multimedia files, backups, archives, and large datasets.
The main advantage of cloud storage is its autoscaling possibility and infinite scale.
Data are stored what's the key value pair.
To put objects into Cloud Storage, we have to start with creating a bucket. A bucket refers to a container used to store and organize data within Google Cloud Storage. A bucket is a top-level container for your objects (files or data) in Google Cloud Storage.
There are four types of buckets:
- Standard - this is the default storage class for objects stored in Google Cloud Storage. It provides high - performance, low - latency access to frequently accessed data.
- Nearline - designed for data that is accessed less frequently but requires quick access when needed. It has a lower storage cost compared to the Standard Storage class but higher retrieval costs.
- Coldline – archiving data that are accessed sporadically. It offers lower storage costs than both Standard and Nearline storage classes, but has higher retrieval costs.
- Archive - long-term data archival where access is extremely infrequent. It has the lowest storage costs but the highest retrieval costs and retrieval times.
Creating a bucket we can also specify in which region the data should be stored. Thanks to that we can increase availability and decrease latency.
Google also provides a Client Library for most popular programming languages. That allows developers to implement Cloud Storage into their existing applications.
DBs
Google Cloud Platform offers a variety of managed database services to meet different application and business requirements.
It is not easy to select correct database that will fit best to your needs. You have to consider many different factors like: schema type, latencies, transactional or data load.
Here are some of the primary types of databases available on GCP:
- Relational DBs
a. OLTP (Online Transaction Processing)
- Cloud SQL: fully-managed relational database service that supports MySQL, PostgreSQL, and SQL Server. It provides automatic backups, updates, and high availability, making it suitable for applications that require a traditional relational database.
- Cloud Spanner: globally distributed, horizontally scalable, and strongly consistent relational database service. It combines the benefits of both traditional relational databases and NoSQL databases, offering global consistency and scalability.
b. OLAP (Online Analytics Processing)
- Google BigQuery: fully-managed, serverless data warehouse and analytics platform provided by Google Cloud. It is designed to handle and analyze large datasets in real-time using SQL-like queries. - NoSQL DBs
a. Cloud Datastore: NoSQL document database that is suitable for web and mobile applications. It is based on the technology behind Google App Engine's original datastore.
b. Cloud Firestore: NoSQL document database that is part of the Firebase platform. It is suitable for web and mobile app development, offering real-time updates and offline support.
c. Cloud Big table: fully - managed NoSQL wide -column store suitable for large analytical and operational workloads. It is designed for massive scalability and is based on the open-source Apache HBase and Google's internal Big table technology. - In memory DB
a. Cloud Memory store: fully-managed in-memory datastore service based on the open-source Red is. It is designed for caching and session storage to enhance the performance of applications.
Pricing
Every service in GCP has its own pricing. If you want to know the estimated costs of using Google infrastructure that will be needed for your application, the first place you should visit is Google cloud pricing calculator:
https://cloud.google.com/products/calculator/
As a new customer you receive $300.00 of free credit that can be used to play with GCP. Not every service can be paid for with it, but it is a good starting point for implementing your first app.
VM pricing
Google offers three types of discounts for VMs:
- Spot VMs – it is a type of VM that can be yours for short term sporadic computations. It can b 60 to 90% cheaper than standard VM. That price comes with several restrictions:
- Spot VM can be run only for 24 hours
- it can be terminated at any time with 30 seconds warning - Sustained use discounts - the more you use your VM, the cheaper it gets. Everything you have to know about this discount is presented on this simple graph:
If your monthly usage is higher, you receive a bigger discount for it.
- Committed use discounts – if you are sure that you will need a specific PM for one year or three years, you can receive a committed use discount. This discount is bigger than the sustained use discount about requests from you specific commitment that cannot be cancelled.
Storage costs
Here is the storage pricing for some Europe locations:
These are of course basic costs of storing data. On top of that, you can have many different options, like multi-region replication or extra cost depending on operation types that you need to perform on your data. The biggest advantage here is that if you need more storage, you just have it. it will cost you more, but you do not need to wait until a new hard drive arrives to your office and someone adds it to your infrastructure.
Summary
Here I have collected some most important topics about GCP. It is just a small part of what Google have to offer with its cloud. Knowing these things, you will be able to start your first application in Google infrastructure. It will also give you a good starting point to go deeper into more complex subjects.
If you need more information, please contact me or visitcloud.google.com. The documentation that is provided there can be very helpful in finding what you need.