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

Get Building Google Cloud Platform Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.