aws-cdk-lib.aws_apigateway.HttpIntegration

class HttpIntegration

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.HttpIntegration
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#HttpIntegration
Javasoftware.amazon.awscdk.services.apigateway.HttpIntegration
Pythonaws_cdk.aws_apigateway.HttpIntegration
TypeScript (source)aws-cdk-lib » aws_apigateway » HttpIntegration

Extends Integration

You can integrate an API method with an HTTP endpoint using the HTTP proxy integration or the HTTP custom integration,.

With the proxy integration, the setup is simple. You only need to set the HTTP method and the HTTP endpoint URI, according to the backend requirements, if you are not concerned with content encoding or caching.

With the custom integration, the setup is more involved. In addition to the proxy integration setup steps, you need to specify how the incoming request data is mapped to the integration request and how the resulting integration response data is mapped to the method response.

Example

declare const authFn: lambda.Function;
declare const books: apigateway.Resource;

const auth = new apigateway.RequestAuthorizer(this, 'booksAuthorizer', {
  handler: authFn,
  identitySources: [apigateway.IdentitySource.header('Authorization')]
});

books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), {
  authorizer: auth
});

Initializer

new HttpIntegration(url: string, props?: HttpIntegrationProps)

Parameters

  • url string
  • props HttpIntegrationProps

Methods

NameDescription
bind(_method)Can be overridden by subclasses to allow the integration to interact with the method being integrated, access the REST API object, method ARNs, etc.

bind(_method)

public bind(_method: Method): IntegrationConfig

Parameters

  • _method Method

Returns

  • IntegrationConfig

Can be overridden by subclasses to allow the integration to interact with the method being integrated, access the REST API object, method ARNs, etc.