Member-only story

Run Flask App on GCP Compute Engine VM Instance

Deploy a flask API on GCP VM Instance and make a postman request to test if it’s running and publicly available

Aman Ranjan Verma
5 min readMar 3, 2023
ARV Creation

Welcome to my blog about deploying a demo Flask program on a Google Cloud Platform (GCP) Compute Engine VM instance. In this blog, I will go over the various steps required to set up a demo Flask application on GCP. We will also make a Postman request to see if it is running and publicly accessible. At the end of the blog, I will discuss some troubleshooting advice and guidance to help with any problems that may arise along the way. Therefore, if you wish to deploy a Flask application on GCP but are uncertain of how to do so, this blog is for you! Let’s get started!

A sample flask App Example

# Importing flask module in the project is mandatory
# An object of Flask class is our WSGI application.
from flask import Flask, request

# current module (__name__) as argument.
app = Flask(__name__)

# The route() function of the Flask class is a decorator,
# which tells the application which URL should call
# the associated function.
@app.route('/')
def return_client_IP():
return 'Hello your IPv4 is: {}'.format(request.remote_addr)

# main driver function
if __name__ == '__main__':

# run() method of Flask class…

--

--

Aman Ranjan Verma
Aman Ranjan Verma

Written by Aman Ranjan Verma

Senior Data engineer, QuillBot | Ex-Flipkart | Ex-Sigmoid. I publish weekly. Available for 1:1 at topmate.io/arverma

Responses (1)