Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pratikkalein/cloud-function-demo
Google Cloud Function demo
https://github.com/pratikkalein/cloud-function-demo
cloud-functions google-cloud-platform python
Last synced: about 10 hours ago
JSON representation
Google Cloud Function demo
- Host: GitHub
- URL: https://github.com/pratikkalein/cloud-function-demo
- Owner: pratikkalein
- License: mit
- Created: 2024-02-07T18:58:25.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-08T19:18:55.000Z (11 months ago)
- Last Synced: 2024-11-11T22:09:50.722Z (2 months ago)
- Topics: cloud-functions, google-cloud-platform, python
- Language: Python
- Homepage: https://pratik.tech/gcf-demo
- Size: 190 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
QR Code Generator
Demo of how to setup and deploy Google Cloud function using Python
View Demo »
## About The Project
This project demonstrates how to deploy a cloud function on Google Cloud.
## Built With
![Python](https://img.shields.io/badge/python-000000?style=for-the-badge&logo=python)
![Flask](https://img.shields.io/badge/Flask-000000?style=for-the-badge&logo=flask)
![Flask](https://img.shields.io/badge/Google%20Cloud-000000?style=for-the-badge&logo=googlecloud)
![Flask](https://img.shields.io/badge/streamlit-000000?style=for-the-badge&logo=streamlit)## Getting Started
### Setting up your Google Cloud account
1. Open the [Google Cloud website](https://cloud.google.com/) and create an account.
2. Create a billing account and activate billing.
3. Create a new project.### Create a new cloud function
1. Open [Cloud Functions](https://console.cloud.google.com/functions) from the hamburger menu or using the search.
2. Click on **CREATE FUNCTION**.
![new-btn](img/create-new-btn.png)
3. Add a function name and choose a region.
4. Click on `Allow unauthenticated invocations`.
![config-1](img/config-1.png)
5. Open Runtime, build, connections and security settings by clicking on the down arrow.
6. Under autoscaling change the `Minimum number of Instances` to **0** and `Maximum number of Instances` to **2**.
![config-1](img/config-2.png)
7. Click on **NEXT**.### Code
1. Choose the runtime as `Python 3.9`.
2. Copy the code from `cloud-function.py` and paste it into the `main.py` file.
3. Copy the requirements from `requirements.txt` and paste it into the `requirements.txt` file.
4. Click on **DEPLOY**.
![code](img/code-1.png)
5. It usually takes 1-2 minutes deploy the function. Once deployed you will get a URL to trigger the function.
6. 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
```7. You can integrate the link in your app. Check the `main.py` for an example.
## License
Distributed under the MIT License. See `LICENSE.txt` for more information.
## Contact
### Pratik Kale
Project Link: [https://github.com/pratikkalein/cloud-function-demo](https://github.com/pratikkalein/cloud-function-demo)
Demo Link : [http://pratik.tech/gcf-demo](http://pratik.tech/gcf-demo)