Comparing Simple GCP Infrastructure Demo to AWS and Azure

AWS, GCP and Azure Intro Demos in a Family Portrait.

Introduction

Working as a Cloud Mentor in my corporation one of my duties is to teach junior cloud developers to create infrastructure as code (IaC). I have created various demonstrations both in AWS and Azure using both Terraform and cloud native tools (CloudFormation and ARM). At the same time I was studying Google Cloud Platform myself. Last month I did two GCP certifications: Associate Cloud Engineer and Professional Cloud Architect. After these studies I decided to create the same simple IaC demonstration using the Google Cloud Platform that I had earlier created for AWS and Azure platforms. I have already written a blog article in which I compared AWS and Azure Terraform implementations (Comparing Simple AWS and Azure Infrastructure Demos). In this new blog post I compare the new GCP demonstration to those previous demonstrations in the AWS and Azure side. All three demonstrations can be found in Tieto / Public Cloud team’s Github account:

Overall Infrastructure as Code Solutions

The overall Terraform solution structure is already explained in the previous blog post (Comparing Simple AWS and Azure Infrastructure Demos — the same title as in this chapter), so I don’t iterate it here. Instead, let’s just briefly summarize the main structure of all these three IaC solutions:

  • Environment definition is hosted in the modules/env-def folder.
  • The modules folder hosts the actual resource modules (in this GCP solution: project, vpc and vm).

Virtual Network / Virtual Private Cloud

The virtual networks (“virtual private cloud” in AWS and GCP) in all solutions are pretty similar. All solutions define the virtual networks themselves (vpc and vnet). Then the modules define a subnet and a security group for the subnet (AWS/Azure) or a firewall rule for the VPC (GCP). Defining these entities using Terraform is incredibly similar in all solutions. The AWS side requires some additional infrastructure boilerplate: an internet gateway and a route table. In the GCP solution you don’t have to assign an address space for the VPC itself since VPC is a global resource in GCP — you assign an address space just for the subnet.

Gathering Resources

This is the main conceptual difference between the solutions. Azure has a concept of a concrete resource group into which you create your cloud resources. AWS has just recently added a resource group concept which is not a concrete resource group but a way to list certain resources based on certain tag keys and values you define for the resource group. GCP has a similar concept as Azure’s resource group: Project.

Virtual Machine

And finally the virtual machine modules: vm (GCP), ec2 (AWS) and vm (Azure).

Infrastructure Code Comparisons

Now that we have three identical IaC solutions in three cloud platforms let’s see how many lines of code each solution comprises:

The Longer Story

All three demonstrations provide README.md files which give a longer explanation regarding that particular demonstration — I encourage the reader to read those files to get a more detailed view regarding the demonstrations (e.g. more detailed explanations regarding Terraform backends in AWS, GCP and Azure sides etc.). At the end of the README files you can also find a detailed demonstration manuscript — you should be able to deploy the infrastructure to GCP, AWS and Azure clouds following the demonstration manuscripts. I tested the AWS and Azure deployments using both my Linux workstation and my virtual Windows 10 workstation, I tested the GCP deployment only using my Linux workstation — If someone wants to test the GCP demonstration manuscript (and possibly provide some powershell scripts instead of my bash scripts) I’m happy to receive a merge request.

Conclusions

All three public clouds— AWS, GCP and Azure — are excellent cloud platforms and you can easily create any infrastructure solution using any of these cloud providers.

I’m a Software architect and developer. Currently implementing systems on AWS / GCP / Azure / Docker / Kubernetes using Java, Python, Go and Clojure.