Skip to main content

Deploying to Google Cloud App Engine

Hands-On Lab

 

Photo of Joseph Lowery

Joseph Lowery

Google Cloud Training Architect II in Content

Length

00:30:00

Difficulty

Beginner

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.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Deploying to Google Cloud App Engine

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.

How to Log in to Google Lab Accounts

On the lab page, right-click Open GCP Console and select the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in to Google Cloud Platform using the credentials provided on the lab page.

On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome L.A.!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

Deploying to Google Cloud App Engine

Now, on to the lab!

Ensure APIs are enabled.

  1. From the main console navigation, go to APIs and Services > Library.
  2. Search for Datastore.
  3. Select the Cloud Datastore API card.
  4. Click Enable, if displayed.

Create a Cloud Storage bucket.

  1. From the Google Cloud console main navigation, choose Cloud Storage.
  2. Click Create bucket.
  3. Name the bucket uniquely and click Continue
  4. In the Location Type section, select Region and click Continue.
  5. Click Create.

Make the bucket contents public.

  1. Navigate to the Permissions tab.
  2. Click Add members.
  3. In the Members field, type allUsers.
  4. Under Roles, choose Storage Object Viewer.
  5. Click Add.

Clone GitHub repository.

  1. Activate the Cloud Shell by clicking its icon in the top row.

  2. Enter the following command to clone the repository for this course:

    git clone https://github.com/linuxacademy/content-gcpro-developer
  3. Change directories:

    cd content-gcpro-developer/app-engine-lab/

Configure config.py file.

  1. Click the pencil icon to launch the Cloud Shell Editor.
  2. In the editor, open config.py in the app-engine-lab folder.
  3. Change PROJECT_ID to the current project, as shown in the Cloud Shell.
  4. Change CLOUD_STORAGE_BUCKET to the name of the bucket previously created.
  5. Save the file.

Deploy the app.

  1. In the Cloud Shell, enter the following:
    gcloud app deploy
  2. When prompted, choose the same region as the bucket created for the lab.

Test the app.

  1. In the Cloud Shell, enter the code:
    gcloud app browse
  2. If the browser window does not open, click the generated link.

Conclusion

Congratulations on completing this lab!