Laurent Picard
Mar 22, 2017 · 3 min read

Once the GCP account is set up (see previously), only a few additional minutes are needed to launch a serverless app from an actual production environment.

Select App Engine
Let’s choose Python but this can also be Node.js, Java, PHP, Go or Ruby
Select the region representative to your audience
The environment is ready in less than a minute
From here, you can follow the interactive tutorial or try a different approach as follows

The interactive tutorial, if followed, will clone a source repository. Willing to start from scratch with a minimal approach, I cancelled the interactive tutorial to follow the “Quickstart for Python App Engine Standard Environment” tutorial. This cannot be more simple. It consists in the following:

  • Install and initialize the “Google Cloud SDK”
  • Get the python-docs-samples/appengine/standard/hello_world sample code (2 files needed, see below)
  • Test the app locally (open http://localhost:8080/)
  • Deploy the app

Only 2 Files Needed for a Minimal App

  • main.py (Python source code)
  • app.yaml (deployment file)

Test Locally

$ dev_appserver.py app.yaml
INFO 2017-03-20 21:36:53,313 devappserver2.py:764] Skipping SDK update check.
INFO 2017-03-20 21:36:53,361 api_server.py:268] Starting API server at: http://localhost:59317
INFO 2017-03-20 21:36:53,375 dispatcher.py:199] Starting module "default" running at: http://localhost:8080
INFO 2017-03-20 21:36:53,375 admin_server.py:116] Starting admin server at: http://localhost:8000
INFO 2017-03-20 21:39:20,387 module.py:806] default: "GET / HTTP/1.1" 200 13

Deploy to Production

$ gcloud app deployYou are about to deploy the following services:
- majestic-gizmo-162110/default/... (from [...app.yaml])
Deploying to URL: [https://majestic-gizmo-162110.appspot.com]
Do you want to continue (Y/n)? YBeginning deployment of service [default]...
File upload done.
Updating service [default]...done.
Deployed service [default] to [https://majestic-gizmo-162110.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s default
To view your application in the web browser run:
$ gcloud app browse

Billing Status

From the moment the app is deployed, the billing status shows estimated costs.

Level Complete!

  • This is as simple as it can be. Deploying a serverless app from scratch to production is a matter of minutes.
  • To avoid using unnecessary resources (and potentially being charged for them), delete the test project (see “Clean up” in the tutorial)
  • This was too easy. Let’s develop an app that actually does something…

Next…

Building a serverless Python app in minutes with GCP

Google Cloud Platform - Community

A collection of technical articles published or curated by Google Cloud Platform Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Laurent Picard

Written by

Tech lover, passionate about software, hardware, science and anything shaping the future • ⛅ explorer at Google • Opinions my own • You can DM me @PicardParis

Google Cloud Platform - Community

A collection of technical articles published or curated by Google Cloud Platform Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade