Building Private APIs Using API Gateway

Building Private APIs Using API Gateway
Building Private APIs Using API Gateway

CLOUD LABS



Building Private APIs Using API Gateway

In this hands-on Cloud Lab, you’ll learn about private RESTful APIs in Amazon API Gateway. These private APIs can only be accessed through resources inside a VPC through a VPC endpoint.

8 Tasks

beginner

1hr 30m

Certificate of Completion

Desktop OnlyDevice is not compatible.
No Setup Required
Amazon Web Services

Learning Objectives

An understanding of private RESTful APIs in API Gateway
The ability to restrict the API access inside a VPC
Hands-on experience creating private APIs through the API Gateway
Hands-on experience invoking a Lambda function through the API Gateway

Technologies
Lambda logoLambda
API Gateway logoAPI Gateway
Skills Covered
Using AWS Cloud Services
Cloud Lab Overview

Amazon API Gateway is an Amazon Web Service that allows us to create, deploy, and manage different types of APIs, such as REST and WebSocket. It also allows you to create private REST APIs that can only be accessed through resources inside a Virtual Private Cloud (VPC) through a VPC endpoint.

In this Cloud Lab, you’ll first create a VPC, attach a security group to it, and then add a VPC endpoint. You’ll then create a Lambda function that will return a simple string when the function is invoked. You’ll use the API Gateway to create and configure a private API so that it can only be accessed by the resources inside your VPC and invokes your Lambda function when its GET method is called. Finally, you’ll create an IDE through Cloud9 inside your VPC and use it to send a request to your private API.

After completing this Cloud Lab, you’ll have a strong knowledge of private APIs in API Gateway and can create your private RESTful APIs. You can configure these APIs to allow resources inside a specific VPC to access your APIs.

The following is the high-level architecture diagram of the infrastructure you’ll create in this Cloud Lab:

Diagram of private APIs architecture using API Gateway for secure backend integrations
Diagram of private APIs architecture using API Gateway for secure backend integrations
Cloud Lab Tasks
1.Introduction
Get Started
2.Create the Required Resources
Create a VPC and a Security Group
Create a VPC Endpoint
Create a Lambda Function
3.Deploy and Test Private APIs
Create a Private API
Test the API in a Cloud9 IDE
4.Conclusion
Clean Up
Wrap Up
Labs Rules Apply
Stay within resource usage requirements.
Do not engage in cryptocurrency mining.
Do not engage in or encourage activity that is illegal.

Before you start...

Try these optional labs before starting this lab.

Relevant Course

Use the following content to review prerequisites or explore specific concepts in detail.

Frequently Asked Questions

Is API Gateway public or private?

Amazon API Gateway supports both public and private APIs.

What is an example of a private API?

A private API in Amazon API Gateway is an API that is accessible only within your Amazon virtual private cloud (VPC). Suppose you have a microservices architecture where certain services, such as a payment processing service, should not be exposed to the public internet. By creating a private API, you can ensure that only resources within your VPC can access this service, thereby maintaining a secure environment.

What is the difference between open API and private API?

Often called public APIs, open APIs allow other developers to create apps that communicate with the service via the public internet, increasing its capability and reach. While the private APIs are used to enhance system integration, data sharing, and internal processes to maintain a secure environment.

Hear what others have to say
Join 1.4 million developers working at companies like