Problem scenario
You want to leverage GCP's serverless App Engine component with its scalability. What do you do?
Solution
1. Go to the cloud shell. In the web UI of GCP in the upper righthand corner go to the icon that looks like this: ">_" and click on it. From cloud shell run these commands:
git clone https://github.com/GoogleCloudPlatform/python-docs-samples
cd python-docs-samples/appengine/standard_python37/hello_world
virtualenv --python python3 ~/envs/hello_world
source ~/envs/hello_world/bin/activate
pip install -r requirements.txt
python main.py
2. In the upper righthand corner there are several icons. When you hover over each one, a pop-up will say something. Click the icon for which "Web preview" appears. Then choose "Preview on port 8080". If it opens a new web browser tab that says "Hello World!", then it worked.
3. Back at the cloud shell, hold the control key and tap "c" (ctrl-c).
4. Run this command: gcloud app create
(Do not be alarmed by the error "already contains an App Engine". Just proceed to the next step.)
5.a. Run this command (but replace contint with the ID of your project*):
gcloud app deploy app.yaml --project contint
5.b. If you are asked if you want to continue, choose "Y" and press enter.
5.c. Run this command: gcloud app browse
6. Click on the URL that appears in the cloud shell. It should take you to a new tab in the web browser. It should say "Hello World!"
* If you want to find the ID of your project, from the GCP web UI, go to "My First Project" or something similar at the top middle part of the screen. Click on it. The pop up should show the project IDs according to their names.