GCP Cloud Developer Certification - 02. Designing an Infrastructure

Agenda

Case Study

GreatInside Company

Existing tech environment

Requirements

Mapping needs to GCP Services

Compute solution

For compute resources, you should consider:

For the GreatInside Company we won't use the solutions above, but VMs in Compute Engine

How to translate cores into vCPUs?

Some people say that cores and vCPUs are equivalent, but that’s not quite true. A vCPU on a Compute Engine instance is implemented as a single hyper-thread on an Intel Xeon processor. Since each Xeon processor has 2 hyperthreads, that means you need to multiply the number of cores by 2 to get the number of threads, and thus the number of vCPUs.

So our Tomcat servers have the equivalent of 8 vCPUs (4 cores times 2) and our IIS servers have the equivalent of 4 vCPUs (2 cores times 2). Of course, if we really wanted to be accurate, we’d need to take into account things like the clock speed of the CPUs, but we’re not going to go that far.

N vCPU ~ 2N cores

(this part didn't make much sense to me...)

2 Dual-core CPUs = 8 vCPUs

IIS Server

Current IIS server Compute requirements
1 Dual-core CPUs 4 vCPUs
16GB of RAM 16GB of RAM
Two 250GB mirrored disks

The n1-standard-4 has 4vCPUs/15GB RAM.

Only 1GB less than the current server, then it should be OK.

Tomcat server

Current Tomcat server Compute requirements
2 Dual-core CPUs 8 vCPUs
24GB of RAM 24GB of RAM
Two 200GB mirrored disks

The n1-standard-8 has 8vCPUs/30GB RAM.

That's 4GB more than what we need. Maybe we can use a custom machine type. So, it's important to compare the costs.

Discounts

Licensing

blablabla boring Microsoft licensing stuff... Options:

also the so called "premium Linux OS licensing". Options:

For both you can use Google pay-as-you-go license or bring your own license.

Preemptible VMs

We will NOT use it in our case study!

Storage solution

Persistent and Local Disks for the VMs

Options:

GreatInside requirements/current scenario:

Note: Persistent disks at GCP are redundant, so no need to mirror disks!

So, let's just use an SSD persistent disk for both and define the specific size we need.

Databases

Differences between Database solutions on GCP:

Note

Relational databases are good to store data for complex data structures with relations between them. But they are hard to scale.

NoSQL databases are easy to scale, but used to store simple information, most likely key/pair data.

Cloud Spanner is a Relational database and massively scalable. But very expensive.

GCP Cloud Developer Certification - 02. Designing an Infrastructure - databases.png

GreatInside Current Scenario:

Current Databases GCP Databases
Interior design app: MySQL Cloud SQL / MySQL
Payment processing: MS SQL Server Cloud SQL / SQL Server
Experimental: NoSQL datastore Try Cloud Datastore / App Engine

High Availability / Instance Groups

To ensure high availability, you need to:

For more information: GCP Systems Operations course.

When creating instance group, choose multi-zone

GCP Cloud Developer Certification - 02. Designing an Infrastructure - overprovision.png

To make the instance group work as a high availability solution, you'll need:

Stateful Data Storage

Networks

There are 5 layers in GCP to isolate and manage resources

Projects

Projects provide a level of separation. In different projects:

Regarding networks, for each project:

Networks and Subnets

GCP Cloud Developer Certification - 02. Designing an Infrastructure - project-network-subnet.png

Regarding Subnets:

Local DNS

Private Google Access

By default, instances connect to GCP services over the internet. Example:

GCP Cloud Developer Certification - 02. Designing an Infrastructure - services over the internet.png

By enabling "Private Google Access" in a subnet, instances connect to GCP services over Google's network using internal IP addresses.

Cross-Project Connections

3 options:

  1. Internet
    • Slower, expensive, insecure
  2. VPC Network Peering
    • Simplest one. RFC-1918
    • Can connect different projects and organizations
    • Both sides have to set up a peering association
    • Can't have any overlapping IP ranges
  3. Shared VPC
    • Complex

GreatInside Network solution

3 Projects:

Also:

How can a system administrator connect to instances for troubleshooting?

GCP Cloud Developer Certification - 02. Designing an Infrastructure - Cloud VPN.png

Security

Authentication

Use "G Suite Global Directory" to manage users.

Roles

Roles are not overwritten in lower hierarchy. In the example below, the user still have the Editor role for lower contexts, it's not overwritten because of the Viewer Role in the project:

GCP Cloud Developer Certification - 02. Designing an Infrastructure - role levels.png

There are a few principles to apply when setting roles and permissions:

  1. Principle of least privilege
  2. Assign roles to groups instead of individuals (I should enforce this at my work)
  3. Control who can add members to groups and change policies
  4. Audit all policy changes by checking the Cloud Audit Logs.

Solution for GreatInside

GCP Cloud Developer Certification - 02. Designing an Infrastructure - GreatInside Roles.png

Service Accounts

GCP uses OAuth 2.0 for API authentication and authorization in two ways

How can shell scripts access GCP services?

GreatInside Service Accounts:

GCP Cloud Developer Certification - 02. Designing an Infrastructure - GreatInside Service Accounts.png

Data Protection and Encryption

ACLs

ACL: Access Control Lists specify who has access to Cloud Storage buckets and objects in buckets.

There are five ways for controlling access to Cloud Storage:

Things might get confusing when using IAM and ACLs:

Encryption

Your data is encrypted in flight and at rest.

Legislation and Compliance

Google provides many features to help you deal with DDoS attacks:

Logging and Monitoring

To be compliant, every step in the payment-processing environment must be monitored and recorded.

Disaster Recovery

Backups + Transactional log files

Always enable automated backups.

When designing a disaster recovery solution, you must consider RPO and RTO.

Summary


Knowledge Check: Designing a Google Cloud Infrastructure

Things I feel I need to study more:

Incorrect answers

Which database service(s) support standard SQL queries?

Cloud Bigtable and Cloud Datastore are NoSQL databases.

Warning

Do not confuse Bigtable with Bigquery.

Review it in this video, at 4:38.

Which of the following statements about encryption on GCP is not true?

There are 3 ways to manage your own encryption keys:

Which statement about IP address pricing in Google Cloud is correct?

From the [official documentation](https://cloud.google.com/vpc/network-pricing#ipaddress:

Type Price/Hour (USD)
Static IP (assigned but unused) 0.01
Static/ephemeral IP on standard VMs 0.004
Static/ephemeral IP on preemptible VMs 0.002
IPs used in forwarding rules/Cloud NAT/Cloud VPN No charge

Which of the following is not a best practice for mitigating Denial of Service attacks on your Google Cloud infrastructure?

These are all best practices for mitigating Denial of Service attacks:

Cloud Router is used to dynamically update VPN routes. It cannot block SYN floods. On the other hand, Google's Frontend infrastructure, which terminates user traffic, automatically scales to absorb certain types of attacks (e.g., SYN floods) before they reach your compute instances.

Learn more: https://cloud.google.com/files/GCPDDoSprotection-04122016.pdf

Which of the following would not reduce your recovery time in the event of a disaster?

A warm standby server would still require manual intervention in the DNS configurations, therefore replacing an active server with a warm standby server would NOT reduce the time to recovery.

To set up a virtual private network between your office network and Google Cloud Platform and have the routes automatically updated when the network topology changes, what is the minimal number of each type of component you need to implement?

VPC networks allow you to regionally segment the network IP space into prefixes (subnets) and control which prefix a VM instance's internal IP address is allocated from. If you want to avoid statically managing these subnets, including the burden of adding and removing related static routes for your VPN, you can do so by enabling dynamic routing for your VPNs using Cloud Router.

GCP Cloud Developer Certification - 02. Designing an Infrastructure - vpn.png

Which of these statements about Microsoft licenses is true?

You cannot migrate your existing Windows Server licenses to Compute Engine, but you can bring your existing Microsoft Application Licenses to your Windows Server instances to run specific applications.

Learn more: https://cloud.google.com/compute/docs/instances/windows/#licensing_for_windows_server_images