How to create Cloud Functions in GCP

This post explains how to create 1st gen HTTP Cloud Function in GCP.

GCP Cloud Functions

Cloud Functions is a serverless execution environment for building and connecting cloud services. Cloud function is triggered when an event being watched is fired, or by an HTTP request. Learn more about Cloud Functions at https://cloud.google.com/functions


See Also: 1st vs 2nd gen Cloud Functions

See Also: How to create 2nd gen Cloud functions


Create 1st gen HTTP Cloud Function

1. Navigate to Google Cloud Console https://console.cloud.google.com/.


2. In the search bar type Cloud Functions and select Cloud Functions from the results.


create gcp cloud functions


3. Click on CREATE FUNCTION.

create gcp cloud functions


4. Enabled the required APIs.

create gcp cloud functions


5. Select the Environment, provide Function Name, select Region. From the Trigger select HTTP and note down the function URL.


create gcp cloud functions


6. In Authentication select Allow unauthenticated invocations and click on SAVE

create gcp cloud functions


7. Keep the default in Runtime, build, connection and security settings and click on NEXT.

create gcp cloud functions


8. In the Runtime select Python 3.9 and click on deploy.

create gcp cloud functions


9. Once the function deployment is complete, hit the URL from 5 and you should see below response in browser.

create gcp cloud functions


Category: GCP