1. Home
  2. Training Library
  3. Google Cloud Platform
  4. Courses
  5. Managing Google Kubernetes Engine and App Engine

Creating a Basic App Engine App

The course is part of this learning path

Google Associate Cloud Engineer Exam Preparation
course-steps 10 certification 1 lab-steps 7
play-arrow
Start course
Overview
DifficultyAdvanced
Duration1h 6m
Students35
Ratings
3.2/5
star star star star-border star-border

Description

Google Cloud Platform has become one of the premier cloud providers on the market. It offers the same rich catalog of services and massive global hardware scale as AWS, as well as a number of Google-specific features and integrations. Mastering the GCP toolset can seem daunting given its complexity. This course is designed to help people familiar with GCP strengthen their understanding of GCP’s compute services, specifically App Engine and Kubernetes Engine.

The Managing Google Kubernetes Engine and App Engine course is designed to help students become confident at configuring, deploying, and maintaining these services. The course will also be helpful to people seeking to obtain Google Cloud certification. The combination of lessons and video demonstrations is optimized for concision and practicality to ensure students come away with an immediately useful skillset.

Learning Objectives

  • Learn how to manage and configure GCP Kubernetes Engine resources
  • Learn how to manage and configure GCP App Engine resources

Intended Audience

  • Individuals looking to build applications using Google Cloud Platform
  • People interested in obtaining GCP certification

Prerequisites

  • Some familiarity with Google Kubernetes Engine, App Engine, and Compute Engine
  • Experience working with command-line tools

Transcript

Creating a basic App Engine app. This lesson will be a walkthrough of how to create a simple Python service using App Engine. Our focus will be on using the command line tools instead of the web console. While the console is nice for beginners thanks to its setup wizards and friendly UI, the terminal is really where our understanding is properly crystallized, so without further ado, let's dive in.

Now, first, we need a proper shell environment. As before, we can work from any computer that has the Google Cloud SDK installed. We could connect to a remote server using SSH and install the gcloud tools there or perhaps easiest of all, we could just use the GCP Cloud shell tool from the console, right from our browser.

Now, whichever you choose, the first thing you'll need to do from the command line is create your App Engine project. This is basically the highest level abstraction for your app. App Engine apps are tied to a project in your GCP account, so you will need your project ID to run the app create command. You can get your project ID from the web console or from running gcloud projects list. So the command for creating your App Engine project will be gcloud app create --project=$PROJECT_ID, so this will create the project.

Now, to verify, you run gcloud app describe. So congratulations, we're done, right? Well, not quite yet. We don't just want some empty App Engine framework with no actual service running. We want to deploy something, so for this lesson, we're going to just use the sample Python app from GCloud's own documentation. Now, if you're not very familiar with Python development, I recommend using the GCP Cloud shell, as it is a standardized environment, so you won't have to worry about Python version or library dependencies. To set up the needed gcloud components, we start by just running this command:

gcloud components install app-engine-python

That will take care of the environment configuration for Python, and then, after that, we need to actually get the code. We need to clone that from GitHub, so we'll do a Git clone. The URL will be posted below. And so, now, we have the code that we intend to deploy. The actual hello world app we want is in the following directory here, it's under python-docs-samples/appengine/standard/hello_world. And then, if you wanna try it out and see what it does, you can actually run this command here, dev_appserver.py app.yaml.

Now, this will start the app server and run the service. Now, if you're doing this from the GCP Cloud shell, all that you're gonna see is some output showing that it's running. This is a decent test, but it's not really what we want. What we'd really like is to see is the app running in a browser and we can't do that from running it on localhost in Cloud Shell, at least not trivially. If you happen to be doing this from your laptop or desktop, you can browse to the app. Using a browser, you can go to http://localhost:8080 and you should see your output.

Now, either way, we still need to actually deploy this thing, right? We need to make it into a real web service reachable from the public internet. Now, fortunately, this is pretty easy to do since it's a completed project. All we have to do is, in that same hello_world directory, we run gcloud app deploy. This will use the app.yaml file in that directory for instructions, and then, actually deploy it to the public internet.

So to actually see it from the browser, you run gcloud app browse, and this will give us the URL that we can navigate to to see the app running. Now, for more fun, go ahead and look at the main.py code to see what the app actually does. Feel free to edit it. You can make it output a different message if you'd like. So with that, we can end our first lesson. You now know the basics of deploying an app in App Engine using the shell. This is, of course, a very simple case. We'll need to go a bit deeper on the actual App Engine configuration, so that you can build confidence for using it in different scenarios. We'll start on that in our next lesson. See you there.

About the Author

Students3140
Courses6

Jonathan Bethune is a senior technical consultant working with several companies including TopTal, BCG, and Instaclustr. He is an experienced devops specialist, data engineer, and software developer. Jonathan has spent years mastering the art of system automation with a variety of different cloud providers and tools. Before he became an engineer, Jonathan was a musician and teacher in New York City. Jonathan is based in Tokyo where he continues to work in technology and write for various publications in his free time.