Reader small image

You're reading from  Google Cloud Certified Professional Cloud Developer Exam Guide

Product typeBook
Published inSep 2021
PublisherPackt
ISBN-139781800560994
Edition1st Edition
Concepts
Right arrow
Author (1)
Sebastian Moreno
Sebastian Moreno
author image
Sebastian Moreno

Sebastian Moreno is a Google Developer Expert for Google Cloud Platform. He currently leads the Cloud Center of Excellence for the Google Cloud Chapter at Everis, an NTT DATA Company, He is working on multiple projects using cloud technologies like cloud innovation, virtual agents, application modernization and data analytics. He has more than eight cloud certifications in multiple cloud providers. He is a Google Cloud Certified Professional Cloud Developer.
Read more about Sebastian Moreno

Right arrow

Chapter 6: Managing APIs on Google Cloud Platform

In this chapter, you will learn how to implement, expose, manage, and secure APIs deployed on Google Cloud Platform using three different runtimes technologies such as FaaS with Cloud Functions, Platform as a Service (PaaS) with Google App Engine, and Container as a Service (CaaS) with Google Kubernetes Engine (GKE). You will also learn the basics and best practices to design and implement an application programming interface API. In this chapter, we will cover the following topics:

  • The basics before implementing an API management solution in Google Cloud
  • How to protect your APIs using Cloud Endpoints on your deployments
  • Discovering the enterprise API management world with Apigee
  • Securing and managing your serverless workloads with the new Cloud API Gateway
  • API development best practices

Technical requirements

The basics before implementing an API management solution in Google Cloud

Before starting to implement an API management solution in our Google Cloud project, it is important to understand some basic concepts about the development of related services, for example, what an API really is, how it differs from a service, what points make up an API management solution, and what tools are available to help us.

In this section, we will review all the basic concepts necessary to understand to implement an API management solution in the cloud.

APIs

An Application Programming Interface (API) is a specification that indicates how different services should interact within a solution, thus allowing their integration and reuse. Although the concept of an API is generally used to refer to services, it is important to say that the concept of an API refers exclusively to the way in which the service should be interacted with (for example, the specification of the request and response) and...

How to protect your APIs using Cloud Endpoints on your deployments

Cloud Endpoints is an API management system offered by Google Cloud for the protection, monitoring, analysis, and control of quotas on our services, using the same service as Google does for its own services.

Cloud Endpoints works through an Extensible Service Provider (ESP) to deliver API management functionalities to your services.

Depending on the communication protocol that your service uses and where it is hosted, there are three Cloud Endpoints options:

  • Cloud Endpoints for OpenAPI: A Cloud Endpoints solution that works with the OpenAPI API description specification.
  • Cloud Endpoints for gRPC: A Cloud Endpoints solution that works with the open source RPC framework developed by Google for high-performance connections, allowing calls between methods of different servers as if they were local objects, facilitating the development of distributed applications.
  • Cloud Endpoints Frameworks: A specific...

Discovering the enterprise API management world with Apigee

Apigee, that is, API Gateway Enterprise Edition, is an API platform product, acquired by Google in 2016, that allows us to manage and protect our services.

In this section, we will review in detail how to implement the Apigee API management solution on a service deployed in Google Cloud.

Deploying a serverless API using Cloud Functions

The first thing we have to do before implementing the Apigee solution is to have an API to work on. In this case, we will deploy an API in Cloud Functions, to demonstrate how to protect a serverless service through Apigee.

For this example, we will deploy a cloud function with a trigger of the HTTP type that, by making a call of the GET type, will obtain the words Dog Resource to simulate obtaining the resource. In a real scenario, this service would return a list of the corresponding resources.

To deploy the cloud function of this example, we will use the following code:

...

Securing and managing your serverless workloads with the new Cloud API Gateway

API Gateway is a fully self-managed API management service with high performance and scalability from Google Cloud. It does not need any type of additional implementation such as proxies or ESP. API Gateway also provides the easy consumption of services for developers, protection of services, and tools for monitoring, alerts, logging, and tracing.

In this section, we will review in detail how to implement an API management solution made in API Gateway on serverless components.

Deploying a serverless API using Cloud Functions

The first thing we have to do before implementing the API Gateway solution is to have an API to work on. In this case, we will deploy an API in Cloud Functions to demonstrate how to protect a serverless service using API Gateway.

For this particular example, we will deploy a cloud function with a trigger of the HTTP type and a GET call to which we will return the words Dog...

API development best practices

In this section, you will learn how to create services based on good practices such as REST APIs and Domain-Driven Design (DDD) in order to make your APIs easier to understand and use and to facilitate discussions within your organization.

An overview of DDD

DDD is a concept that allows us to structure our services so that they align with our business domain. A detailed understanding of how to implement DDD within our organization requires a lot of experience, both in developing services and in business domains. In this section, we will briefly summarize the different integrated concepts within DDD and how they relate to each other. This will give us an initial baseline understanding of what DDD is and what its benefits are.

DDD is separated into two key concepts, tactical design, which pertains to structuring at the code level, and strategic design, which is about structuring at the organizational level.

Within tactical design, we have the...

Summary

In this chapter, we have learned that API management is a group of concepts that helps us to expose, protect, monitor, and document our services inside an organization. We’ve also reviewed in detail three solutions that Google Cloud provides for exposing our services (Cloud Endpoints, Apigee, and API Gateway), and seen how DDD and REST practices can help us to create a better API ecosystem within our organization. In the next chapter, we will see how to manage unstructured data within solutions implemented in Google Cloud, in order to handle large amounts of data and take advantage of the benefits of the cloud to reduce costs.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Google Cloud Certified Professional Cloud Developer Exam Guide
Published in: Sep 2021Publisher: PacktISBN-13: 9781800560994
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Sebastian Moreno

Sebastian Moreno is a Google Developer Expert for Google Cloud Platform. He currently leads the Cloud Center of Excellence for the Google Cloud Chapter at Everis, an NTT DATA Company, He is working on multiple projects using cloud technologies like cloud innovation, virtual agents, application modernization and data analytics. He has more than eight cloud certifications in multiple cloud providers. He is a Google Cloud Certified Professional Cloud Developer.
Read more about Sebastian Moreno