hands-on lab

Building an API with Google Cloud API Gateway

Difficulty: Beginner
Duration: Up to 1 hour
Students: 370
Rating: 4.2/5
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.

Description

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

Prerequisites

No prerequisites are required.

Updates

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

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