O'Reilly logo

Google Cloud Platform Cookbook by Legorie Rajan PS

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

In this recipe, we'll create a Linux instance and run a simple Flask application. In the web application, we'll write code to capture an error and send it to Stackdriver Error Reporting:

  1. Let's first create an instance to host our Flask application. Note that the access scope allows full access to all Cloud APIs:
$ gcloud compute instances create flask-instance --image=debian-9-stretch-v20180307 --image-project "debian-cloud" --machine-type=f1-micro --scopes cloud-platform --zone us-east1-c --tags flask-server --project <Project ID>
  1. Next, we'll open the firewall for this instance (network tag: flask-server) on port 5000:
$ gcloud compute firewall-rules create default-allow-http-5000 --allow tcp:5000 --source-ranges 0.0.0.0/0 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required