topics/gcp/README.md
| Name | Topic | Objective & Instructions | Solution | Comments |
|---|---|---|---|---|
| Create a project | Organization | Exercise | Solution | |
| Assign roles | IAM | Exercise | Solution |
| Name | Topic | Objective & Instructions | Solution | Comments |
|---|---|---|---|---|
| Create an instance | Compute, Labels | Exercise | Solution |
GCP regions are data centers hosted across different geographical locations worldwide.
Within each region, there are multiple isolated locations known as Zones. Each zone is one or more data-centers with redundant network and connectivity and power supply. Multiple zones ensure high availability in case one of them goes down
</b></details>
<details> <summary>True or False? Each GCP region is designed to be completely isolated from the other GCP regions </summary> <b>True. </b></details>
<details> <summary>What considerations to take when choosing an GCP region for running a new application?</summary> <b>False. You can see here which products/services available in each region. </b></details>
gcloud compute regions list
</b></details>
Organization Folder Project Resources
</b></details>
<details> <summary>True or False? In a project, you can have one or more organizations</summary> <b>False. It's quite the opposite. First there is an organization and under organization you can have one or more folder with one or more projects. </b></details>
<details> <summary>True or False? A resource has to be associated with at least one project</summary> <b>True. You can't have resources associate with no projects. </b></details>
<details> <summary>True or False? Project name has to be globally unique</summary> <b>True. </b></details>
Role is an encapsulation of set of permissions. For example an "owner" role has more than 3000 assigned permissions to the different components and services of GCP. </b></details>
<details> <summary>True or False? Permissive parent policy will always overrule restrictive child policy</summary> <b>True </b></details>
You can think about labels in GCP as sticky notes that you attach to different GCP resources. That makes it easier for example, to search for specific resources (like applying the label called "web-app" and search for all the resources that are related somehow to "web-app") </b></details>
<details> <summary>Can you provide some examples to labels usage in GCP?</summary> <b>As the name suggests, network tags can be applied only to network resources. While labels don't affect the resources on which they are applied, network tags do affect resources (e.g. firewall access and networking routes) </b></details>
gcloud compute instances describe instance-1 --format "yaml(labels)"
</b></details>
gcloud compute instances update instance-1 --update-labels app=db
</b></details>
gcloud compute instances update instance-1 --remove-labels env
</b></details>
gcloud compute instances create instance-1 --labels app=web,env=dev --machine-type=e2-micro
</b></details>
Virtual Private Cloud(VPC) network is a virtual version of physical network, implemented in Google's internal Network. VPC is a global resource in GCP. Subnetworks(subnets) are regional resources, ie., subnets can be created withinin regions.
VPC are created in 2 modes,
Auto mode VPC - One subnet in each region is created automatically by GCP while creating VPC
Custom mode VPC - No subnets are automatically created. This type of network provides complete control over the subnets creation to the users. </b></details>
Google Cloud Functions is a serverless execution environment for building and connecting cloud services. With Cloud Functions you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services. Your function is triggered when an event being watched is fired.
</b></details>
<details> <summary>What is Cloud Datastore?</summary> <b>Cloud Datastore is a schemaless NoSQL datastore in Google's cloud. Applications can use Datastore to query your data with SQL-like queries that support filtering and sorting. Datastore replicates data across multiple datacenters, which provides a high level of read/write availability.
</b></details>
<details> <summary>What network tags are used for?</summary> <b>Network tags allow you to apply firewall rules and routes to a specific instance or set of instances: You make a firewall rule applicable to specific instances by using target tags and source tags.
</b></details>
<details> <summary>What are flow logs? Where are they enabled?</summary> <b>VPC Flow Logs records a sample of network flows sent from and received by VM instances, including instances used as Google Kubernetes Engine nodes. These logs can be used for network monitoring, forensics, real-time security analysis, and expense optimization.
Enable Flow Logs
Open VPC Network in GCP Console
Click the name of the subnet
Click EDIT button
Set Flow Logs to On
Click Save
</b></details>
<details> <summary>How do you list buckets?</summary> <b> Two ways to do that:$ gsutil ls
$ gcloud alpha storage ls
</b></details>
<details> <summary>What Compute metadata key allows you to run code at startup?</summary> <b>startap-script </b></details>
<details> <summary>What the following commands does? `gcloud deployment-manager deployments create`</summary> <b>Deployment Manager creates a new deployment.
</b></details>
<details> <summary>What is Cloud Code?</summary> <b> It is a set of tools to help developers write, run and debug GCP kubernetes based applications. It provides built-in support for rapid iteration, debugging and running applications in development and production K8s environments. </b></details>fun fact: Anthos is flower in greek, they grow in the ground (earth) but need rain from the clouds to flourish. </b></details>
<details> <summary>List the technical components that make up Anthos</summary> <b>On GCP the kubernetes api-server is the only control plane component exposed to customers whilst compute engine manages instances in the project. </b></details>
<details> <summary>Which load balancing options are available?</summary> <b>It is a core component of the Anthos stack which provides platform, service and security operators with a single, unified approach to multi-cluster management that spans both on-premises and cloud environments. It closely follows K8s best practices, favoring declarative approaches over imperative operations, and actively monitors cluster state and applies the desired state as defined in Git. It includes three key components as follows:
It follows common modern software development practices which makes cluster configuration, management and policy changes auditable, revertable, and versionable easily enforcing IT governance and unifying resource management in an organisation. </b></details>
<details> <summary>What is Anthos Service Mesh?</summary> <b>It is part of the Anthos stack that brings a serverless container experience to Anthos, offering a high-level platform experience on top of K8s clusters. It is built with Knative, an open-source operator for K8s that brings serverless application serving and eventing capabilities. </b></details>
<details> <summary>How does Cloud Run for Anthos simplify operations?</summary> <b>Platform teams in organisations that wish to offer developers additional tools to test, deploy and run applications can use Knative to enhance this experience on Anthos as Cloud Run. Below are some of the benefits;
As it does not support stateful applications or sticky sessions, it is suitable for running stateless applications such as: