- Lab
- A Cloud Guru
Deploying to Google Cloud App Engine
Google Cloud App Engine provides a solid, easy-to-access platform for a wide range of web apps. Its interoperability with other Google Cloud services, such as Cloud Storage, enhance its effectiveness. In this hands-on lab, we’ll deploy an app to App Engine that allows users to upload photos and enter details into a NoSQL database, Cloud Datastore. The process requires that we set up a Cloud Storage bucket initially and then customize the `config.py` file before deploying the app.
Path Info
Table of Contents
-
Challenge
Enable Cloud Datastore APIs and create a Cloud Storage bucket.
- From the main console navigation, go to APIs and Services > Library.
- Search for Datastore.
- Select the Cloud Datastore API card.
- Click Enable, if displayed.
- Repeat steps 1-4 twice more to enable the App Engine Admin and Cloud Build APIs.
- From the main console navigation, choose Cloud Storage.
- Click Create bucket.
- Name the bucket uniquely and click Continue.
- From the Location Type options, select Region and, in the Location field, select us-central1.
- Click Create.
-
Challenge
Make the bucket contents public.
- Return to the Cloud Storage main Browser page.
- Expand the More (3 dots) menu for the new bucket, at the far right of the entry.
- Choose Edit bucket permissions.
- When the Info panel is displayed, click Add Principal.
- In the New principals field, enter allUsers.
- Click into the Select a role field, scroll down to Cloud Storage and select Storage Object Viewer.
- Click Save and confirm that you want to allow public access when prompted.
-
Challenge
Clone GitHub repository.
-
From the Cloud Shell, issue the following command to clone the repository for this course:
git clone https://github.com/linuxacademy/content-gcpro-developer
-
Change directories to
content-gcpro-developer/app-engine-lab-2/
.
-
-
Challenge
Configure `config.py` file.
-
Activate the Cloud Shell by clicking its icon in the top row.
-
If the Cloud Shell does not display the current project ID in yellow, open the Project panel by clicking the project name in the upper-left.
-
Copy the current project ID.
-
In the Cloud Shell, enter the following command:
gcloud config set project <PROJECT_ID>
-
Click Open Editor.
-
Expand the
content-gcpro-developer
folder and then theapp-engine-labs
sub-folder. -
Open
config.py
. -
On line 35, change
PROJECT_ID
to the current project, as shown in the Cloud Shell. -
On line 93, change
CLOUD_STORAGE_BUCKET
to name of the bucket previously created. -
Save the file.
-
-
Challenge
Deploy the app.
- In the Cloud Shell, deploy your app with the following code:
gcloud app deploy
- When prompted, choose the same region as the bucket created for the lab.
- When prompted, enter
Y
to continue.
- In the Cloud Shell, deploy your app with the following code:
-
Challenge
Test the app.
- In the Cloud Shell, enter the code:
gcloud app browse
- If the browser window does not open, click the generated link.
- When the app appears in the browser, click Add Artwork and complete the subsequent form to test the app.
- In the Cloud Shell, enter the code:
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.