hands-on lab

Building an API with Google Cloud API Gateway

Up to 1h
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


If you are building a microservice, you need to find a way to expose it. Suppose you are working with Cloud Functions or with Cloud Run. If you want to expose them using a structured and secure API, you should consider using Cloud API Gateway. Cloud API Gateway is a fully managed, easy-to-use, and secure Google service that allows you to create an API for the workload you need to expose. It offers reduced complexity because it lets you define the API using the Swagger OpenAPI 2.0 standard. Following this standard, you would define the specifics about the method of exposing your workloads, such as the path and the protocol.

In this lab, you will create a Cloud Function, and you will create an API with Cloud API Gateway to expose it.

Learning Objectives

Upon completion of this lab, you will be able to:

  • Create an API definition following the OpenAPI 2.0 standard
  • Expose a workload with an API through Cloud API Gateway

Intended Audience

This lab is intended for:

  • Google Cloud Professional Cloud Developer (PCD) candidates
  • Software engineers that need to expose workloads hosted on Google Cloud
  • Cloud Architects who want to understand how to handle and expose multiple workloads in a structured way


No prerequisites are required.


August 10th, 2023 - Addressed user ban issue and promptly added a warning 

April 20th, 2022 - Updated the instructions and screenshots to reflect the latest UI

Environment before

Environment after

About the author

Learning paths

Stefano studies Computer Science and is passionate about technology. He loves working with Cloud services and learning all the best practices for them. Google Cloud Platform and Amazon Web Services are the cloud providers he prefers. He is a Google Cloud Certified Associate Cloud Engineer. Node.js is the programming language he always uses to code. When he's not involved in studying or working, Stefano loves riding his motorbike and exploring new places.

Covered topics

Lab steps

Signing In to the Google Cloud Console
Creating a Cloud Function to Expose
Creating OpenAPI 2.0 Specification for the API
Deploying an API to Google Cloud API Gateway