0% found this document useful (0 votes)
4 views4 pages

CC Lab4

This document provides a step-by-step guide for deploying a web application on Google App Engine with automatic scaling enabled. It includes instructions for setting up the Google Cloud Console, creating necessary files, and configuring the application for deployment. Additionally, it covers monitoring and managing the application post-deployment, including automatic scaling and log viewing.

Uploaded by

Shreya G T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

CC Lab4

This document provides a step-by-step guide for deploying a web application on Google App Engine with automatic scaling enabled. It includes instructions for setting up the Google Cloud Console, creating necessary files, and configuring the application for deployment. Additionally, it covers monitoring and managing the application post-deployment, including automatic scaling and log viewing.

Uploaded by

Shreya G T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

4.

APP ENGINE: DEPLOY A WEB APPLICATION ON APP ENGINE WITH AUTOMATIC SCALING
ENABLED.
Google App engine is a Platform -as -a -Service (PaaS) that lets you build, deploy and host web
applications on Google’s infrastructure handling infrastructure management and scaling
automatically.

Step1: Log in to your google cloud console

Step2: Enable the required API’s

Before deploying your application, enable the App Engine API:

Search for APP engine in the search tab

Step3: Click on create application-> then select the area [asia-south1]->Click Next->

Step4: Create a simple application

Folder structure:

/my-app-demo

├── app.yaml # GCP App Engine configuration

├── main.py # Your Flask app code

└── requirements.txt # Python dependencies

• Open cloud Shell application in a new tab and create a project directory

mkdir my-app-demo

• pip install gunicorn in the terminal


• Next, type nano main.py
• Under main .py file type the below code
from flask import Flask

app = Flask(__name__)

@app.route('/')

def home():

return 'Welcome to google app engine with auto scaling'

if __name__ == '__main__':

app.run(host='0.0.0.0', port=8080)

Now, Type CTRL+S to save your code, then CTRL+X Y then enter key

Step5: Create a requirement file.txt

nano requirements.txt

inside the file, add the following dependencies

Flask==2.0.1

gunicorn

Step6: Create a yaml file i.e. nano app. yaml

runtime: python311

entrypoint: gunicorn -b:$PORT main:app

automatic_scaling:

min_instances: 1

max_instances: 5

target_cpu_utilization: 0.65

target_throughput_utilization: 0.75

handlers:

11- url: /.*

12 script: auto

Save and close (CTRL + X, Y, Enter).


**Type ls in the command prompt to see whether all three files are successfully created**

Step7: run the command-> gcloud components update

Then type -> gcloud app browse

[optional**If your getting bad gateway error while viewing your app then install

sudo apt install nginx -y]

Then type gcloud app update

Next, gcloud app deploy type y when prompted

Click on the https project link where the app is been deployed
Step 8: Monitor and Manage Your Application

• Automatic Scaling: The configuration in app.yaml enables automatic scaling based on CPU
and throughput utilization. You can adjust the min_instances and max_instances values as
needed.

• Logs: You can view logs for your application using:

To check the log, gcloud app logs tail -s default

You might also like