{"id":19083257,"url":"https://github.com/psingh12354/google-cloud","last_synced_at":"2026-05-23T09:30:17.552Z","repository":{"id":185587930,"uuid":"301047732","full_name":"Psingh12354/Google-Cloud","owner":"Psingh12354","description":"Google Qwiklab","archived":false,"fork":false,"pushed_at":"2021-08-27T05:11:41.000Z","size":610,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-02T20:43:55.568Z","etag":null,"topics":["beginner","complete","google","google-cloud-platform","notes","qwiklabs","step-by-step-guide"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Psingh12354.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-10-04T05:36:29.000Z","updated_at":"2024-06-22T09:27:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"9cb6d42b-b02b-4aaa-b6f7-9da379b88398","html_url":"https://github.com/Psingh12354/Google-Cloud","commit_stats":null,"previous_names":["psingh12354/google-cloud"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FGoogle-Cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FGoogle-Cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FGoogle-Cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FGoogle-Cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Psingh12354","download_url":"https://codeload.github.com/Psingh12354/Google-Cloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240133141,"owners_count":19752993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginner","complete","google","google-cloud-platform","notes","qwiklabs","step-by-step-guide"],"created_at":"2024-11-09T02:46:45.001Z","updated_at":"2026-05-23T09:30:17.513Z","avatar_url":"https://github.com/Psingh12354.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=center\u003e\u003ci\u003e\u003cb\u003eGoogle Cloud\u003c/b\u003e\u003c/i\u003e\u003c/h1\u003e\n\n\u003cp align=center\u003e\u003cimg src=\"https://github.com/Psingh12354/Google-Cloud-/blob/main/Qwik.png\" width=100 height=100\u003e\u003c/img\u003e\u003c/p\u003e\n\n\u003ch3 align=center\u003e\u003ci\u003e\u003cb\u003eWelcome! to the Qwicklab\u003c/b\u003e\u003c/i\u003e\u003c/h3\u003e\n\n### Go to qwiklab here [click me](https://google.qwiklabs.com/)\n\n### About Navigation\n\nThe **Navigation menu** is an important component of the Cloud Console—it offers quick access to the platform's services and also outlines its offerings. If you scroll through the menu, you will see that there are seven categories of Google Cloud services:\n\n- **Compute:** houses a variety of machine types that support any type of workload. The different computing options let you decide how involved you want to be with operational details and infrastructure amongst other things.\n- **Storage:** data storage and database options for structured or unstructured, relational or non relational data.\n- **Networking:** services that balance application traffic and provision security rules amongst other things.\n- **Cloud Operations:** a suite of cross-cloud logging, monitoring, trace, and other service reliability tools.\n- **Tools:** services for developers managing deployments and application build pipelines.\n- **Big Data:** services that allow you to process and analyze large datasets.\n- **Artificial Intelligence:** a suite of APIs that run specific artificial intelligence and machine learning tasks on Google Cloud.\n\n### Terminal Open\n\nTo open a terminal on google cloud find the square on top right corner like this |\u003e'| and click there\n\n### Auth-list\n\nTo open the auth list type this command on terminal\n```\ngcloud auth list\n```\n\n### Types of Access Specifier\n\n![](https://github.com/Psingh12354/Google-Cloud-/blob/main/Google.PNG)\n\n### Text File\n\n```\ntouch text.txt\n```\n\n### List the file\n\n```\nls\n```\n\n### Read the cloud shell\n\n```\nREADME-cloudshell.txt  test.txt\n```\n\n### To _open_ the file in terminal\n\n```\nnano test.txt\n```\n### Process to come out from nano\nPress\n- Control + X\n- Y\n- Enter\n\n### To _read_ the file in terminal\n\n```\ncat test.txt\n```\n\n\u003ch2 align=center\u003e\u003ci\u003e\u003cb\u003eCreating a Virtual Machiene\u003c/b\u003e\u003c/i\u003e\u003c/h2\u003e\n\nYou can list the project ID with this command:\n\n```\ngcloud config list project\n```\n\n### output\n\n```\n[core]\nproject = qwiklabs-gcp-44776a13dea667a6\n```\n\n## Understanding Regions and Zones\nCertain Compute Engine resources live in regions or zones. A region is a specific geographical location where you can run your resources. Each region has one or more zones. For example, the us-central1 region denotes a region in the Central United States that has zones ```us-central1-a```, ```us-central1-b```, ```us-central1-c```, and ```us-central1-f```.\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/Region.PNG)\n\nResources that live in a zone are referred to as zonal resources. Virtual machine Instances and persistent disks live in a zone. To attach a persistent disk to a virtual machine instance, both resources must be in the same zone. Similarly, if you want to assign a static IP address to an instance, the instance must be in the same region as the static IP.\n\n### Create a new instance from the Cloud Console\n\nIn this section, you'll learn how to create new pre-defined machine types with Compute Engine from the Cloud Console.\n\nIn the Cloud Console, on the top left of the screen, select **Navigation menu \u003e Compute Engine \u003e VM Instances:**\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/Instance.PNG)\nThis may take a minute to initialize for the first time.\n\nTo create a new instance, click **Create**.\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/create.PNG)\n\nThere are many parameters you can configure when creating a new instance. Use the following for this lab:\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/instance1.PNG)\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/instance2.PNG)\n\nClick **Create.**\n\nWait for it to finish - it shouldn't take more than a minute.\n\nOnce finished, you should see the new virtual machine in the **VM Instances** page.\n\nTo SSH into the virtual machine, click on **SSH** on the right hand side. This launches a SSH client directly from your browser.\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/SSh.PNG)\n\n## Install a NGINX web server\nNow you'll install NGINX web server, one of the most popular web servers in the world, to connect your virtual machine to something.\n\nOnce SSH'ed, get ```root``` access using ```sudo```:\n```\nsudo su -\n```\nAs the ```root``` user, update your OS:\n```\napt-get update\n```\n(Output)\n```\nGet:1 http://security.debian.org stretch/updates InRelease [94.3 kB]\nIgn http://deb.debian.org strech InRelease\nGet:2 http://deb.debian.org strech-updates InRelease [91.0 kB]\n...\n```\n### Install NGINX:\n```\napt-get install nginx -y\n```\n(Output)\n```\nReading package lists... Done\nBuilding dependency tree\nReading state information... Done\nThe following additional packages will be installed:\n...\n```\n### Check that NGINX is running:\n```\nps auwx | grep nginx\n```\n(Output)\n```\nroot      2330  0.0  0.0 159532  1628 ?        Ss   14:06   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;\nwww-data  2331  0.0  0.0 159864  3204 ?        S    14:06   0:00 nginx: worker process\nwww-data  2332  0.0  0.0 159864  3204 ?        S    14:06   0:00 nginx: worker process\nroot      2342  0.0  0.0  12780   988 pts/0    S+   14:07   0:00 grep nginx\n```\nAwesome! To see the web page, go to the Cloud Console and click the External IP link of the virtual machine instance. You can also see the web page by adding the ```External``` IP to ```http://EXTERNAL_IP/``` in a new browser window or tab.\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/SSh.PNG)\n\nYou should see this default web page:\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/ngins.PNG)\n\nTo check your progress in this lab, click Check my progress below. A checkmark means you're on track.\n\n### Create a new instance with gcloud\n\nRather than using the Cloud Console to create a virtual machine instance, you can use the command line tool gcloud, which is pre-installed in Google Cloud Shell. Cloud Shell is a Debian-based virtual machine loaded with all the development tools you'll need (gcloud, git, and others) and offers a persistent 5GB home directory.\n\nIn the Cloud Shell, create a new virtual machine instance from the command line using ```gcloud```:\n```\ngcloud compute instances create gcelab2 --machine-type n1-standard-2 --zone us-central1-c\n```\n(Output)\n```\nCreated [...gcelab2].\nNAME     ZONE           MACHINE_TYPE  ...    STATUS\ngcelab2  us-central1-c  n1-standard-2 ...    RUNNING\n```\nThe instance created has these default values:\n\n- The latest Debian 9 (stretch) image.\n- The n1-standard-2 machine type. In this lab you can select one of these other machine types if you'd like: n1-highmem-4 or n1-highcpu-4. When you're working on a project outside of Qwiklabs, you can also specify a custom machine type.\n- A root persistent disk with the same name as the instance; the disk is automatically attached to the instance.\nRun ```gcloud compute instances create --help``` to see all the defaults.\n```\nNote: You can set the default region and zones that gcloud uses if you are always working within one region/zone and you don't want to append the --zone flag every time. Do this by running these commands :\n\ngcloud config set compute/zone ...\n\ngcloud config set compute/region ...\n```\nTo exit help, press **Ctrl+c**.\n\nCheck out your instances. Select **Navigation menu \u003e Compute Engine \u003e VM instances.** You should see the 2 instances you created in this lab.\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/SSh.PNG)\n\na new gcelab added here\n\nFinally, you can SSH into your instance using ```gcloud``` as well. Make sure you add your zone, or omit the ```--zone``` flag if you've set the option globally:\n```\ngcloud compute ssh gcelab2 --zone us-central1-c\n```\n(Output)\n```\nWARNING: The public SSH key file for gcloud does not exist.\nWARNING: The private SSH key file for gcloud does not exist.\nWARNING: You do not have an SSH key for gcloud.\nWARNING: [/usr/bin/ssh-keygen] will be executed to generate a key.\nThis tool needs to create the directory\n[/home/gcpstaging306_student/.ssh] before being able to generate SSH\nKeys.\n```\nNow you'll type **Y** to continue.\n```\nDo you want to continue? (Y/n)\n```\n**Enter** through the passphrase section to leave the passphrase empty.\n```\nGenerating public/private rsa key pair.\nEnter passphrase (empty for no passphrase)\n```\nAfter connecting, you disconnect from SSH by exiting from the remote shell:\n```\nexit\n```\n\n\u003ch1 align=center\u003e\u003ci\u003e\u003cb\u003eGetting Started with Cloud Shell \u0026 gcloud\u003c/b\u003e\u003c/i\u003e\u003c/h1\u003e\n\n### Project Id\n\n```\ngcloud compute project-info describe --project \u003cyour_project_ID\u003e\n```\n\n## Setting environment variables\n\nEnvironment variables are variables that define your environment. Define your own variables and save yourself time when writing scripts that contain APIs or executables.\n\nMake a couple of environment variables:\n\n```\nexport PROJECT_ID=\u003cyour_project_ID\u003e\n```\n\nSet your ZONE environment variable (use the value for zone from the earlier command):\n\n```\nexport ZONE=\u003cyour_zone\u003e\n```\n\nVerify that your variables were set properly:\n\n```\necho $PROJECT_ID\necho $ZONE\n```\n\n## Create a virtual machine with gcloud\n\nCreate a new virtual machine instance using ```gcloud```. In the following command you'll use:\n\n```gcloud compute``` which enables you to easily manage your Compute Engine resources in a friendlier format than using the Compute Engine API.\n```instances create``` creates a new instance.\nRun the following to create your vm:\n\n```\ngcloud compute instances create gcelab2 --machine-type n1-standard-2 --zone $ZONE\n```\n(Output)\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/outputgit.png)\n\n### If you got a error : \n\n```\nERROR: (gcloud.compute.instances.create) The required property [project] is not currently set.\nYou may set it for your current workspace by running:\n  $ gcloud config set project VALUE\nor it can be set temporarily by the environment variable [CLOUDSDK_CORE_PROJECT]\nstudent_03_c58135da19e3@cloudshell:~$\n```\n\n### Use this :\n\n```\ngcloud config set command \u003cProject_ID\u003e //command can be project or something else with id \nlike -:: \ngcloud config set  project qwiklabs-gcp-00-4b2e8b079910\n\n```\n\n- The name of the vm is \"gcelab2\",\n- You're using the ```--machine-type``` flag to specify the machine type as \"n1-standard-2\"\n- You're using the ```--zone``` flag to specify that it gets created in the zone you defined with your environment variable.\n\n## Using gcloud commands\n\n```gcloud``` offers simple usage guidelines that are available by adding the ```-h```flag (for help) onto the end of any ```gcloud``` invocation.\n\nRun the following command in Cloud Shell:\n\n```\ngcloud -h\n```\n\nMore verbose help can be obtained by appending ```--help``` flag, or executing ```gcloud``` help command. Run the following in Cloud Shell:\n```\ngcloud config --help\n```\nUse the **Enter** key or the **Spacebar** to scroll through the help content.\n\nType q to exit the content.\n\nNow run the following command:\n\n```\ngcloud help config\n```\n\nYou can see that the ```gcloud config --help``` and ```gcloud help config``` commands are equivalent. Both give long, detailed help.\n\n[gcloud Global Flags](https://cloud.google.com/sdk/gcloud/reference/) govern the behavior of commands on a per-invocation level. Flags override any values set in SDK properties.\n\nView the list of configurations in your environment:\n\n```\ngcloud config list\n```\n\nTo check how other properties are set, see all properties by calling:\n\n```\ngcloud config list --all\n```\n\nList your components:\n\n```\ngcloud components list\n```\n\nHere you will see what components are ready for you to use in this lab. Next you'll install a new component.\n\n## Auto-completion\n\n```gcloud interactive``` has auto prompting for commands and flags, and displays inline help snippets in the lower section as the command is typed.\n\nStatic information, like command and sub-command names, and flag names and enumerated flag values, are auto-completed using dropdown menus.\n\nInstall the beta components:\n\n```\nsudo apt-get install google-cloud-sdk\n```\n\nEnter the ```gcloud interactive``` mode:\n\n```\ngcloud beta interactive\n```\n\nWhen using the interactive mode, click on the **Tab** key to complete file path and resource arguments. If a dropdown menu appears, use the **Tab** key to move through the list, and the **Space bar** to select your choice.\n\nTry it out! Start typing the following command, using auto-complete to finish the command:\n\n```\ngcloud compute instances describe \u003cyour_vm\u003e\n```\n\nAcross the bottom of Cloud Shell you can see the shortcut to toggle this feature. Try out the F2 toggle:\n\nF2:help:STATE Toggles the active help section, ON when enabled, OFF when disabled.\n\n## SSH into your vm instance\n```gcloud compute``` makes connecting to your instances easy. The ```gcloud``` compute ssh command provides a wrapper around ```SSH```, which takes care of authentication and the mapping of instance name to IP address.\n\nUse ```gcloud compute ssh``` to SSH into your vm:\n\n```\ngcloud compute ssh gcelab2 --zone $ZONE\n```\n\n(Output)\n\n```\nWARNING: The public SSH key file for gcloud does not exist.\nWARNING: The private SSH key file for gcloud does not exist.\nWARNING: You do not have an SSH key for gcloud.\nWARNING: [/usr/bin/ssh-keygen] will be executed to generate a key.\nThis tool needs to create the directory\n[/home/gcpstaging306_student/.ssh] before being able to generate SSH Keys.\n```\n\nType \"Y\" to continue:\n\n```\nDo you want to continue? (Y/n)\n```\n\nPress the **Enter** key through the passphrase section to leave the passphrase empty.\n\n```\nGenerating public/private rsa key pair.\nEnter passphrase (empty for no passphrase)\n```\n\nYou don't need to do anything here, so disconnect from SSH by exiting from the remote shell by typing \"exit\":\n\n```\nexit\n```\nYou should be back at your project's command prompt.\n\n## Use the Home directory\nNow try out your Home directory. The contents of your Cloud Shell Home directory persists across projects between all Cloud Shell sessions, even after the virtual machine terminates and is restarted.\n\nChange your current working directory:\n\n```\ncd $HOME\n```\n\nOpen your ```.bashrc``` configuration file using ```vi``` text editor:\n\n```\nvi ./.bashrc\n```\n\nThe editor opens and displays the contents of the file. Press the ```ESC``` key and then ```:wq``` to exit the editor.\n\n\n\u003ch1\u003e\u003ci\u003e\u003cb\u003eKubernetes Engine: Qwik Start\u003c/b\u003e\u003c/i\u003e\u003c/h1\u003e\n\nYou can list the active account name with this command:\n\n```\ngcloud auth list\n```\n\n(Output)\n\n```\nCredentialed accounts:\n - \u003cmyaccount\u003e@\u003cmydomain\u003e.com (active)\n```\n(Example output)\n```\nCredentialed accounts:\n - google1623327_student@qwiklabs.net\n```\nYou can list the project ID with this command:\n```\ngcloud config list project\n```\n(Output)\n```\n[core]\nproject = \u003cproject_ID\u003e\n```\n(Example output)\n```\n[core]\nproject = qwiklabs-gcp-44776a13dea667a6\n```\n\n## Setting a default compute zone\nYour compute zone is an approximate regional location in which your clusters and their resources live. For example, us-central1-a is a zone in the us-central1 region.\n\nStart a new session in Cloud Shell and run the following command to set your default compute zone to us-central1-a:\n\ngcloud config set compute/zone us-central1-a\n\nYou receive the following output:\n\nUpdated property [compute/zone].\nCreating a Kubernetes Engine cluster\nA cluster consists of at least one cluster master machine and multiple worker machines called nodes. Nodes are Compute Engine virtual machine (VM) instances that run the Kubernetes processes necessary to make them part of the cluster.\n\nTo create a cluster, run the following command, replacing [CLUSTER-NAME] with the name you choose for the cluster (for example my-cluster). Cluster names must start with a letter, end with an alphanumeric, and cannot be longer than 40 characters.\n\n```\ngcloud container clusters create [CLUSTER-NAME]\n```\nYou can ignore any warnings in the output. It might take several minutes to finish creating the cluster. Soon after you should receive a similar output:\n```\nNAME        LOCATION       ...   NODE_VERSION  NUM_NODES  STATUS\nmy-cluster  us-central1-a  ...   1.15.12-gke.2  3          RUNNING\n```\n\n## Creating a Kubernetes Engine cluster\n\nA [cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture) consists of at least one cluster master machine and multiple worker machines called nodes. Nodes are [Compute Engine virtual machine (VM) instances](https://cloud.google.com/compute/docs/instances/) that run the Kubernetes processes necessary to make them part of the cluster.\n\nTo create a cluster, run the following command, replacing ```[CLUSTER-NAME]``` with the name you choose for the cluster (for example ```my-cluster```). Cluster names must start with a letter, end with an alphanumeric, and cannot be longer than 40 characters.\n\n### Important\n\n```\ngcloud config set  project qwiklabs-gcp-00-4b2e8b079910\n```\n\n```\ngcloud container clusters create [CLUSTER-NAME]\n```\n\nYou can ignore any warnings in the output. It might take several minutes to finish creating the cluster. Soon after you should receive a similar output:\n\n```\nNAME        LOCATION       ...   NODE_VERSION  NUM_NODES  STATUS\nmy-cluster  us-central1-a  ...   1.15.12-gke.2  3          RUNNING\n```\n\n## Get authentication credentials for the cluster\n\nAfter creating your cluster, you need to get authentication credentials to interact with the cluster.\n\nTo authenticate the cluster run the following command, replacing ```[CLUSTER-NAME]``` with the name of your cluster:\n\n```\ngcloud container clusters get-credentials [CLUSTER-NAME]\n```\n\nYou should receive a similar output:\n```\nFetching cluster endpoint and auth data.\nkubeconfig entry generated for my-cluster.\n```\n\n## Deploying an application to the cluster\nNow that you have created a cluster, you can deploy a containerized application to it. For this lab you'll run ```hello-app``` in your cluster.\n\nKubernetes Engine uses Kubernetes objects to create and manage your cluster's resources. Kubernetes provides the Deployment object for deploying stateless applications like web servers. Service objects define rules and load balancing for accessing your application from the Internet.\n\nRun the following [kubectl create](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#create) command in Cloud Shell to create a new Deployment ```hello-server``` from the ```hello-app```container image:\n\n```\nkubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0\n```\n\nYou should receive the following output:\n```\ndeployment.apps/hello-server created\n```\n\nThis Kubernetes command creates a Deployment object that represents hello-server. In this case, --image specifies a container image to deploy. The command pulls the example image from a Google Container Registry bucket. gcr.io/google-samples/hello-app:1.0 indicates the specific image version to pull. If a version is not specified, the latest version is used.\n\nNow create a Kubernetes Service, which is a Kubernetes resource that lets you expose your application to external traffic, by running the following kubectl expose command:\n\nkubectl expose deployment hello-server --type=LoadBalancer --port 8080\n\nIn this command:\n\n- ```--port specifies``` the port that the container exposes.\n- ```type=\"LoadBalancer\"``` creates a Compute Engine load balancer for your container.\nYou should receive the following output:\n\n```\nservice/hello-server exposed\n```\nInspect the hello-server Service by running kubectl get:\n```\nkubectl get \n```\nYou should receive a similar output:\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/out1.png)\n\n```\nNote: It might take a minute for an external IP address to be generated. Run the above command again if the EXTERNAL-IP column is in \"pending\" status.\n```\nFrom this command's output, copy the Service's external IP address from the ```EXTERNAL IP``` column.\n\nView the application from your web browser using the external IP address with the exposed port:\n\n```\nhttp://[EXTERNAL-IP]:8080\n```\nYour page should resemble the following:\n\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/out2.png)\n\n## Clean Up\n\nRun the following to delete the cluster:\n\n```\ngcloud container clusters delete [CLUSTER-NAME]\n```\n\nWhen prompted, type Y to confirm. Deleting the cluster can take a few minutes. For more information on deleted Google Kubernetes Engine clusters, view the documentation.\n\nClick Check my progress to \n\n\u003ch1 align=center\u003e\u003cb\u003e\u003ci\u003eSet Up Network and HTTP Load Balancers\u003c/i\u003e\u003c/b\u003e\u003c/h1\u003e\n\n## Activate Cloud Shell\n\nYou can list the active account name with this command:\n\n```\ngcloud auth list\n```\n\n(Output)\n\n```\nCredentialed accounts:\n - \u003cmyaccount\u003e@\u003cmydomain\u003e.com (active)\n ```\n \n(Example output)\n\n```\nCredentialed accounts:\n - google1623327_student@qwiklabs.net\n```\n\nYou can list the project ID with this command:\n\n```\ngcloud config list project\n```\n\n(Output)\n\n```\n[core]\nproject = \u003cproject_ID\u003e\n```\n\n(Example output)\n\n```\n[core]\nproject = qwiklabs-gcp-44776a13dea667a6\n```\n\n## Set the default region and zone for all resources\nIn Cloud Shell, set the default zone:\n\n```\ngcloud config set compute/zone us-central1-a\n```\n\nSet the default region:\n\n```\ngcloud config set compute/region us-central1\n```\n\n## Create multiple web server instances\nTo simulate serving from a cluster of machines, create a simple cluster of Nginx web servers to serve static content using Instance Templates and Managed Instance Groups. Instance Templates define the look of every virtual machine in the cluster (disk, CPUs, memory, etc). Managed Instance Groups instantiate a number of virtual machine instances using the Instance Template.\n\nTo create the Nginx web server clusters, create the following:\n\n- A startup script to be used by every virtual machine instance to setup Nginx server upon startup\n- An instance template to use the startup script\n- A target pool\n- A managed instance group using the instance template\n\nStill in Cloud Shell, create a startup script to be used by every virtual machine instance. This script sets up the Nginx server upon startup:\n\n```\ncat \u003c\u003c EOF \u003e startup.sh\n#! /bin/bash\napt-get update\napt-get install -y nginx\nservice nginx start\nsed -i -- 's/nginx/Google Cloud Platform - '\"\\$HOSTNAME\"'/' /var/www/html/index.nginx-debian.html\nEOF\n```\n\nCreate an instance template, which uses the startup script:\n\n```\ngcloud compute instance-templates create nginx-template \\\n         --metadata-from-file startup-script=startup.sh\n```\n\n(Output)\n\n```\nCreated [...].\nNAME           MACHINE_TYPE  PREEMPTIBLE CREATION_TIMESTAMP\nnginx-template n1-standard-1             2015-11-09T08:44:59.007-08:00\n```\n\nCreate a target pool. A target pool allows a single access point to all the instances in a group and is necessary for load balancing in the future steps.\n\n```\ngcloud compute target-pools create nginx-pool\n```\n\n(Output)\n\n```\nCreated [...].\nNAME       REGION       SESSION_AFFINITY BACKUP HEALTH_CHECKS\nnginx-pool us-central1\n```\n\nCreate a managed instance group using the instance template:\n\n```\ngcloud compute instance-groups managed create nginx-group \\\n         --base-instance-name nginx \\\n         --size 2 \\\n         --template nginx-template \\\n         --target-pool nginx-pool\n```\n\n(Output)\n\n```\nCreated [...].\nNAME         LOCATION       SCOPE  BASE_INSTANCE_NAME  SIZE  TARGET_SIZE  INSTANCE_TEMPLATE  AUTOSCALED\nnginx-group  us-central1-a  zone   nginx               0     2            nginx-template     no\n```\n\nThis creates 2 virtual machine instances with names that are prefixed with ```nginx-```. This may take a couple of minutes.\n\nList the compute engine instances and you should see all of the instances created:\n\n```\ngcloud compute instances list\n```\n\n(Output)\n\n```\nNAME       ZONE           MACHINE_TYPE  PREEMPTIBLE INTERNAL_IP EXTERNAL_IP    STATUS\nnginx-7wvi us-central1-a n1-standard-1             10.240.X.X  X.X.X.X           RUNNING\nnginx-9mwd us-central1-a n1-standard-1             10.240.X.X  X.X.X.X           RUNNING\n```\n\nNow configure a firewall so that you can connect to the machines on port 80 via the ```EXTERNAL_IP``` addresses:\n\ngcloud compute firewall-rules create www-firewall --allow tcp:80\n\nYou should be able to connect to each of the instances via their external IP addresses via ```http://EXTERNAL_IP/``` shown as the result of running the previous command.\n\n## Create a Network Load Balancer\nNetwork load balancing allows you to balance the load of your systems based on incoming IP protocol data, such as address, port, and protocol type. You also get some options that are not available, with HTTP(S) load balancing. For example, you can load balance additional TCP/UDP-based protocols such as SMTP traffic. And if your application is interested in TCP-connection-related characteristics, network load balancing allows your app to inspect the packets, where HTTP(S) load balancing does not.\n\nCreate an L4 network load balancer targeting your instance group:\n\n```\ngcloud compute forwarding-rules create nginx-lb \\\n         --region us-central1 \\\n         --ports=80 \\\n         --target-pool nginx-pool\n```\n\n(Output)\n\n```\nCreated [https://www.googleapis.com/compute/v1/projects/...].\n```\n\nList all Compute Engine forwarding rules in your project.\n\n```\ngcloud compute forwarding-rules list\n```\n\n(Output)\n\n```\nNAME     REGION       IP_ADDRESS     IP_PROTOCOL TARGET\nnginx-lb us-central1 X.X.X.X        TCP         us-central1/targetPools/nginx-pool\n```\n\nYou can then visit the load balancer from the browser http://IP_ADDRESS/ where IP_ADDRESS is the address shown as the result of running the previous command.\n\n## Create a HTTP(s) Load Balancer\nHTTP(S) load balancing provides global load balancing for HTTP(S) requests destined for your instances. You can configure URL rules that route some URLs to one set of instances and route other URLs to other instances. Requests are always routed to the instance group that is closest to the user, provided that group has enough capacity and is appropriate for the request. If the closest group does not have enough capacity, the request is sent to the closest group that does have capacity.\n\nFirst, create a health check. Health checks verify that the instance is responding to HTTP or HTTPS traffic:\n\n```\ngcloud compute http-health-checks create http-basic-check\n```\n\n(Output)\n\n```\nCreated [https://www.googleapis.com/compute/v1/projects/...].\nNAME             HOST PORT REQUEST_PATH\nhttp-basic-check      80   /\n```\n\nDefine an HTTP service and map a port name to the relevant port for the instance group. Now the load balancing service can forward traffic to the named port:\n\n```\ngcloud compute instance-groups managed \\\n       set-named-ports nginx-group \\\n       --named-ports http:80\n```\n\n(Output)\n\n```\nUpdated [https://www.googleapis.com/compute/v1/projects/...].\n```\n\nCreate a backend service:\n\n```\ngcloud compute backend-services create nginx-backend \\\n      --protocol HTTP --http-health-checks http-basic-check --global\n```\n\n(Output)\n\n```\nCreated [https://www.googleapis.com/compute/v1/projects/...].\nNAME          BACKENDS PROTOCOL\nnginx-backend          HTTP\n```\n\nAdd the instance group into the backend service:\n\n```\ngcloud compute backend-services add-backend nginx-backend \\\n    --instance-group nginx-group \\\n    --instance-group-zone us-central1-a \\\n    --global\n```\n\n(Output)\n\n```\nUpdated [https://www.googleapis.com/compute/v1/projects/...].\n```\n\nCreate a default URL map that directs all incoming requests to all your instances:\n\n```\ngcloud compute url-maps create web-map \\\n    --default-service nginx-backend\n```\n\n(Output)\n\n```\nCreated [https://www.googleapis.com/compute/v1/projects/...].\nNAME    DEFAULT_SERVICE\nWeb-map nginx-backend\n```\n\nCreate a target HTTP proxy to route requests to your URL map:\n\n```\ngcloud compute target-http-proxies create http-lb-proxy \\\n    --url-map web-map\n```\n\n(Output)\n\n```\nCreated [https://www.googleapis.com/compute/v1/projects/...].\nNAME          URL_MAP\nhttp-lb-proxy web-map\n```\n\nCreate a global forwarding rule to handle and route incoming requests. A forwarding rule sends traffic to a specific target HTTP or HTTPS proxy depending on the IP address, IP protocol, and port specified. The global forwarding rule does not support multiple ports.\n\n```\ngcloud compute forwarding-rules create http-content-rule \\\n        --global \\\n        --target-http-proxy http-lb-proxy \\\n        --ports 80\n```\n\n(Output)\n\n```\nCreated [https://www.googleapis.com/compute/v1/projects/...].\n```\n\nAfter creating the global forwarding rule, it can take several minutes for your configuration to propagate.\n\n```\ngcloud compute forwarding-rules list\n```\n(Output)\n\n```\nNAME              REGION IP_ADDRESS    IP_PROTOCOL TARGET\nhttp-content-rule        X.X.X.X       TCP         http-lb-proxy\nnginx-lb   us-central1  X.X.X.X       TCP         us-central1/....\n```\n\nTake note of the http-content-rule IP_ADDRESS for the forwarding rule.\n\nFrom the browser, you should be able to connect to ```http://IP_ADDRESS/```. It may take three to five minutes. If you do not connect, wait a minute then reload the browser.\n\n\u003ch1 align=center\u003e\u003cb\u003e\u003ci\u003eGetting Started: Create and Manage Cloud Resources: Challenge Lab\u003c/i\u003e\u003c/b\u003e\u003c/h1\u003e\n\n## Challenge scenario\nYou have started a new role as a Junior Cloud Engineer for Jooli Inc. You are expected to help manage the infrastructure at Jooli. Common tasks include provisioning resources for projects.\n\nYou are expected to have the skills and knowledge for these tasks, so don't expect step-by-step guides to be provided.\n\nSome Jooli Inc. standards you should follow:\n\nCreate all resources in the default region or zone, unless otherwise directed.\nNaming is normally team-resource, e.g. an instance could be named nucleus-webserver1\nAllocate cost effective resource sizes. Projects are monitored and excessive resource use will result in the containing project's termination (and possibly yours), so beware. This is the guidance the monitoring team is willing to share; unless directed use f1-micro for small Linux VMs and n1-standard-1 for Windows or other applications such as Kubernetes nodes.\nYour challenge\nAs soon as you sit down at your desk and open your new laptop you receive several requests from the Nucleus team. Read through each description, then create the resources.\n\n## Task 1: Create a project jumphost instance\n\nWe will use this instance to perform maintenance for the project.\n\nMake sure you:\n\nname the instance ```nucleus-jumphost```\nuse the machine type of f1-micro\nuse the default image type (Debian Linux)\n\n## Solution :\n\n```\ngcloud compute instances create nucleus-jumphost \\\n                  --network nucleus-vpc \\\n                  --zone us-east1-b  \\\n                  --machine-type f1-micro  \\\n                  --image-family debian-9  \\\n                  --image-project debian-cloud \\\n                  --scopes cloud-platform \\\n                  --no-address\n                  \n                  Or \n                  \nNavigation menu \u003e Compute engine \u003e VM Instance                  \n```\n\n## Task 2: Create a Kubernetes service cluster\n\n```\nYou have a limit to the resources you are allowed to create in your project, if you don't get the result you expected please delete the cluster before you create another cluster or the lab might exit and you might get banned.\nThe team is building an application that will use a service. This service will run on Kubernetes. You need to:\n```\n\n- Create a cluster (in the us-east1-b zone) to host the service\n- Use the Docker container hello-app (`gcr.io/google-samples/hello-app:2.0`) as a place holder, the team will replace the container with their own work later\n- Expose the app on port 8080\n\n### Solution(Each step one by one)\n```\nCreate a Kubernetes service cluster\n\ngcloud config set compute/zone us-east1-b\n\ngcloud container clusters create nucleus-webserver1\n\ngcloud container clusters get-credentials nucleus-webserver1\n\nkubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0\n\nkubectl expose deployment hello-app --type=LoadBalancer --port 8080\n\nkubectl get service \n```\n\n## Task 3: Setup an HTTP load balancer\n\nWe will serve the site via nginx web servers, but we want to ensure we have a fault tolerant environment, so please create an HTTP load balancer with a managed instance group of **two nginx web servers**. Use the following to configure the web servers, the team will replace this with their own configuration later.\n\n```\nYou have a limit to the resources you are allowed to create in your project, so do not create more than two instances in your managed instance group or the lab might exit and you might get banned.\n```\n\n```\ncat \u003c\u003c EOF \u003e startup.sh\n#! /bin/bash\napt-get update\napt-get install -y nginx\nservice nginx start\nsed -i -- 's/nginx/Google Cloud Platform - '\"\\$HOSTNAME\"'/' /var/www/html/index.nginx-debian.html\nEOF\n```\n\nYou need to:\n\n- Create an instance template\n- Create a target pool\n- Create a managed instance group\n- Create a firewall rule to allow traffic (80/tcp)\n- Create a health check\n- Create a backend service and attach the manged instance group\n- Create a URL map and target HTTP proxy to route requests to your URL map\n- Create a forwarding rule\n\n ### Solution(Step by step) : \n \n ```\n 1 .Create an instance template :\n\ngcloud compute instance-templates create nginx-template \\\n--metadata-from-file startup-script=startup.sh\n\n2 .Create a target pool :\n\ngcloud compute target-pools create nginx-pool\n```\n\n**Note :** Press No and select region which is given in you first question.\n\n```\n3 .Create a managed instance group :\n\ngcloud compute instance-groups managed create nginx-group \\\n--base-instance-name nginx \\\n--size 2 \\\n--template nginx-template \\\n--target-pool nginx-pool\n\ngcloud compute instances list\n\n4 .Create a firewall rule to allow traffic (80/tcp) :\n\ngcloud compute firewall-rules create www-firewall --allow tcp:80\n\ngcloud compute forwarding-rules create nginx-lb \\\n--region us-east1 \\\n--ports=80 \\\n--target-pool nginx-pool\n\ngcloud compute forwarding-rules list\n\n5 .Create a health check :\n\ngcloud compute http-health-checks create http-basic-check\n\ngcloud compute instance-groups managed \\\nset-named-ports nginx-group \\\n--named-ports http:80\n\n6 .Create a backend service and attach the manged instance group :\n\ngcloud compute backend-services create nginx-backend \\\n--protocol HTTP --http-health-checks http-basic-check --global\n\ngcloud compute backend-services add-backend nginx-backend \\\n--instance-group nginx-group \\\n--instance-group-zone us-east1-b \\\n--global\n\n7 .Create a URL map and target HTTP proxy to route requests to your URL map :\n\ngcloud compute url-maps create web-map \\\n--default-service nginx-backend\n\ngcloud compute target-http-proxies create http-lb-proxy \\\n--url-map web-map\n\n8 .Create a forwarding rule :\n\ngcloud compute forwarding-rules create http-content-rule \\\n--global \\\n--target-http-proxy http-lb-proxy \\\n--ports 80\n\ngcloud compute forwarding-rules list\n```\n![](https://github.com/Psingh12354/Google-Cloud/blob/main/final%20Output.PNG)\n\n**Note :** It may take certain time so do not close the qwiklab window wait and copy above 3 ip \n           address and paste in in seprate windows and refresh it till you got the output(**can take more than a minutes**)\n           \n **Ctrl+Z** to quit the cloud console in case not working\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsingh12354%2Fgoogle-cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsingh12354%2Fgoogle-cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsingh12354%2Fgoogle-cloud/lists"}