
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Deploy to App Engine
/ 30
Deploy to Kubernetes Engine
/ 30
Deploy to Cloud Run
/ 40
In this lab, you will deploy applications to the Google Cloud services App Engine, Kubernetes Engine, and Cloud Run.
In this lab, you will learn how to perform the following tasks:
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Sign in to Qwiklabs using an incognito window.
Note the lab's access time (for example, 1:15:00
), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
You need some source code to manage. So, you will create a simple Python Flask web application. The application will be only slightly better than "hello world", but it will be good enough to test the pipeline you will build.
3.9. Enter the following command in Cloud Shell to create a folder called gcp-course
:
deploying-apps-to-gcp
:main.py
and press Enter.deploying-apps-to-gcp
folder.templates
and press Enter.templates
folder and create a new file called layout.html
.Also in the templates folder, add another new file called index.html
.
Add the following code and save the file as you did before:
In Python, application prerequisites are managed using pip. Now you will add a file that lists the requirements for this application.
In the deploying-apps-to-gcp folder (not the templates folder), create a New File and add the following to that file and save it as requirements.txt
:
The first step to using Docker is to create a file called Dockerfile. This file defines how a Docker container is constructed. You will do that now.
The file Dockerfile is used to define how the container is built.
The program should be displayed in a new browser tab.
Ctrl+C
to stop the program.App Engine is a completely automated deployment platform. It supports many languages, including Python, Java, JavaScript, and Go. To use it, you create a configuration file and deploy your applications with a couple of simple commands. In this task, you create a file named app.yaml and deploy it to App Engine.
gcp-course/deploying-apps-to-gcp
folder in the explorer tree on the left.gcloud app create
command and specifying the region where you want the app to be created. Click Open Terminal and type the following command. If prompted, click Authorize:On the Google Cloud console title bar, type App Engine in the Search field, then click App Engine in the Search Results section.
In the upper-right corner of the dashboard is a link to your application, similar to this:
https://project-id.appspot.com
.
Click on the link to test your program.
Make a change to the program to see how easy the App Engine makes managing versions.
In the code editor, expand the /deploying-apps-to-gcp
folder in the navigation pane on the left. Then, click main.py to open it.
In the main() function, change the title to Hello App Engine
as shown below:
Click File > Save in the code editor toolbar to save your change.
Now, deploy version two with the following command:
--no-promote
parameter tells App Engine to continue serving requests with the old version. This allows you to test the new version before putting it into production.
When the command completes, return to the App Engine dashboard. Click the link again, and version one will still be returned. It should return Hello GCP
. This is because of the --no-promote
parameter in the previous command.
On the left, click the Versions tab. Notice that two versions are listed.
Click on the version two link to test it. It should return Hello App Engine
.
To migrate production traffic to version two, click Split Traffic at the top. Change the version to two, and click Save.
Give it a minute to complete. Refresh the browser tab that earlier returned Hello GCP
. It should now return the new version.
Click Check my progress to verify the objective.
Kubernetes Engine allows you to create a cluster of machines and deploy any number of applications to it. Kubernetes abstracts the details of managing machines and allows you to automate the deployment of your applications with simple CLI commands.
To deploy an application to Kubernetes, you first need to create the cluster. Then you need to add a configuration file for each application you will deploy to the cluster.
On the Navigation menu (), click Kubernetes Engine. If a message appears saying the Kubernetes API is being initialized, wait for it to complete.
Click Create Cluster then click Switch to Standard Cluster confirm Switch to Standard Cluster.
Click Zonal for Location type and then select the zone
Click the three dots to the right of the cluster and then click Connect.
In the Connect to the cluster screen, click Run in Cloud Shell. This opens Cloud Shell with the connect command entered automatically.
Press Enter to connect to the cluster.
To test your connection, type the following command:
This command simply shows the machines in your cluster. If it works, you're connected.
gcp-course/deploying-apps-to-gcp
folder in the navigation pane on the left. Then, click main.py to open it.Hello Kubernetes Engine
as shown below:kubernetes-config.yaml
to the gcp-course/deploying-apps-to-gcp
folder.Note: In the first section of the YAML file above, you are configuring a deployment. In this case, you are deploying 3 instances of your Python web app. Notice the image attribute. You will update this value with your image in a minute after you build it. In the second section, you are configuring a service of the type "load balancer". The load balancer will have a public IP address. Users will access your application through the load balancer.
For more information on Kubernetes deployments and services, see the links below:
When the previous command completes, the image name will be listed in the output. The image name is in the form
Highlight your image name and copy it to the clipboard. Paste that value in the kubernetes-config.yaml
file, overwriting the string <YOUR IMAGE PATH HERE>.
You should see something similar to below:
Make sure all the pods are ready. If they aren't, wait a few seconds and try again.
You should see something similar to below:
If the load balancer's external IP address says "pending", wait a few seconds and try again.
Hello Kubernetes Engine
. It might take a few seconds to be ready.Click Check my progress to verify the objective.
Cloud Run simplifies and automates deployments to Kubernetes. When you use Cloud Run, you don't need a configuration file. You simply choose a cluster for your application. With Cloud Run, you can use a cluster managed by Google, or you can use your own Kubernetes cluster.
To use Cloud Run, your application needs to be deployed using a Docker image and it must be stateless.
gcp-course/deploying-apps-to-gcp
folder in the navigation pane on the left. Then, click main.py to open it.Hello Cloud Run
as shown below:Save your change.
To use Cloud Run, you need to build a Docker image. In Cloud Shell, type the following commands to use Cloud Build to create the image and store it in Artifact Registry:
When the build completes, on the Google Cloud console title bar, type Cloud Run in the Search field, then click Cloud Run in the Products & Pages section.
Click Create service. This enables the Cloud Run API.
Click the Select link in the Container image URL
text box and then click Artifact Registry. In the resulting dialog, expand Region-docker.pkg.dev/$DEVSHELL_PROJECT_ID/devops-demo > cloud-run-image and select the image listed. Then click Select.
In Service name, type hello-cloud-run and select region
For Authentication, select Allow unauthenticated invocations.
In Container(s), Volumes, Networking, Security, select Default in the Execution environment section.
In Revision scaling, set the Maximum number of instances to 6. Leave the rest as defaults.
Finally, click Create.
It shouldn't take long for the service to deploy. When a green check appears, click on the URL that is automatically generated for the application. It should return Hello Cloud Run
.
Click Check my progress to verify the objective.
In this lab, you deployed applications to the Google Cloud services App Engine, Kubernetes Engine, and Cloud Run.
When you have completed your lab, click End Lab. Google Cloud Skills Boost removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one