Demo of how to setup and deploy Google Cloud function using Python
View Demo »
This project demonstrates how to deploy a cloud function on Google Cloud.
- Open the Google Cloud website and create an account.
- Create a billing account and activate billing.
- Create a new project.
- Open Cloud Functions from the hamburger menu or using the search.
- Click on CREATE FUNCTION.
- Add a function name and choose a region.
- Click on
Allow unauthenticated invocations
.
- Open Runtime, build, connections and security settings by clicking on the down arrow.
- Under autoscaling change the
Minimum number of Instances
to 0 andMaximum number of Instances
to 2. - Click on NEXT.
- Choose the runtime as
Python 3.9
. - Copy the code from
cloud-function.py
and paste it into themain.py
file. - Copy the requirements from
requirements.txt
and paste it into therequirements.txt
file. - Click on DEPLOY.
- It usually takes 1-2 minutes deploy the function. Once deployed you will get a URL to trigger the function.
- You can test the function using this URL by adding
?link=https://yourlink.com
https://us-central1-project-name.cloudfunctions.net/function-2?link=https://yourlink.com
- You can integrate the link in your app. Check the
main.py
for an example.
Distributed under the MIT License. See LICENSE.txt
for more information.
Project Link: https://github.com/pratikkalein/cloud-function-demo
Demo Link : http://pratik.tech/gcf-demo