AWS Fundamentals Logo
AWS Fundamentals

Amazon API Gateway

43 CDK constructs available in aws-cdk-lib/aws-apigateway

import * as apigateway from 'aws-cdk-lib/aws-apigateway';

L2 Constructs21

Higher-level abstractions with sensible defaults and convenience methods.

ApiKey

L2

An API Gateway ApiKey. An ApiKey can be distributed to API clients that are executing requests for Method resources that require an Api Key.

BasePathMapping

L2

This resource creates a base path that clients who call your API must use in the invocation URL. Unless you're importing a domain with `DomainName.fromDomainNameAttributes()`, you can use `DomainName.addBasePathMapping()` to define mappings.

CognitoUserPoolsAuthorizer

L2

Cognito user pools based custom authorizer.

Deployment

L2

A Deployment of a REST API. An immutable representation of a RestApi resource that can be called by users using Stages. A deployment must be associated with a Stage for it to be callable over the Internet. Normally, you don't need to define deployments manually. The RestApi construct manages a Deployment resource that represents the latest model. It can be accessed through `restApi.latestDeployment` (unless `deploy: false` is set when defining the `RestApi`). If you manually define this resource, you will need to know that since deployments are immutable, as long as the resource's logical ID doesn't change, the deployment will represent the snapshot in time in which the resource was created. This means that if you modify the RestApi model (i.e. add methods or resources), these changes will not be reflected unless a new deployment resource is created. To achieve this behavior, the method `addToLogicalId(data)` can be used to augment the logical ID generated for the deployment resource such that it will include arbitrary data. This is done automatically for the `restApi.latestDeployment` deployment. Furthermore, since a deployment does not reference any of the REST API resources and methods, CloudFormation will likely provision it before these resources are created, which means that it will represent a "half-baked" model. Use the `node.addDependency(dep)` method to circumvent that. This is done automatically for the `restApi.latestDeployment` deployment.

DomainName

L2

GatewayResponse

L2

Configure the response received by clients, produced from the API Gateway backend.

LambdaRestApi

L2

Defines an API Gateway REST API with AWS Lambda proxy integration. Use the `proxy` property to define a greedy proxy ("{proxy+}") and "ANY" method from the specified path. If not defined, you will need to explicity add resources and methods to the API.

Method

L2

Model

L2

ProxyResource

L2

Defines a {proxy+} greedy resource and an ANY method on a route.

RateLimitedApiKey

L2

An API Gateway ApiKey, for which a rate limiting configuration can be specified.

RequestAuthorizer

L2

Request-based lambda authorizer that recognizes the caller's identity via request parameters, such as headers, paths, query strings, stage variables, or context variables. Based on the request, authorization is performed by a lambda function.

RequestValidator

L2

Resource

L2

RestApi

L2

Represents a REST API in Amazon API Gateway. Use `addResource` and `addMethod` to configure the API model. By default, the API will automatically be deployed and accessible from a public endpoint.

SpecRestApi

L2

Represents a REST API in Amazon API Gateway, created with an OpenAPI specification. Some properties normally accessible on

Stage

L2

StepFunctionsRestApi

L2

Defines an API Gateway REST API with a Synchrounous Express State Machine as a proxy integration.

TokenAuthorizer

L2

Token based lambda authorizer that recognizes the caller's identity as a bearer token, such as a JSON Web Token (JWT) or an OAuth token. Based on the token, authorization is performed by a lambda function.

UsagePlan

L2

VpcLink

L2

Define a new VPC Link Specifies an API Gateway VPC link for a RestApi to access resources in an Amazon Virtual Private Cloud (VPC).

L1 Constructs22

Direct CloudFormation resource mappings. One-to-one with CloudFormation resource types.

Get the Amazon API Gateway Cheat Sheet

Everything you need to know about Amazon API Gateway on one page. HD quality, print-friendly.

Download Free Infographic

Quick Facts

L2 Constructs21
L1 Constructs22
Moduleaws-cdk-lib/aws-apigateway