Deploying a serverless env in minutes with GCP

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.

Image for post
Image for post
Select App Engine
Image for post
Image for post
Let’s choose Python but this can also be Node.js, Java, PHP, Go or Ruby
Image for post
Image for post
Select the region representative to your audience
Image for post
Image for post
The environment is ready in less than a minute
Image for post
Image for post
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
  • main.py (Python source code)
  • app.yaml (deployment file)
$ 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
Image for post
Image for post
$ 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
Image for post
Image for post

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

Image for post
Image for post
  • 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…

Building a serverless Python app in minutes with GCP

Google Cloud - Community

Google Cloud community articles and blogs

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 - Community

A collection of technical articles and blogs published or curated by Google Cloud 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 - Community

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

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store