HttpLambdaIntegration
- class aws_cdk.aws_apigatewayv2_integrations.HttpLambdaIntegration(id, handler, *, parameter_mapping=None, payload_format_version=None, scope_permission_to_route=None, timeout=None)
Bases:
HttpRouteIntegrationThe Lambda Proxy integration resource for HTTP API.
- ExampleMetadata:
infused
Example:
from aws_cdk.aws_apigatewayv2_integrations import HttpUrlIntegration, HttpLambdaIntegration # book_store_default_fn: lambda.Function get_books_integration = HttpUrlIntegration("GetBooksIntegration", "https://get-books-proxy.example.com") book_store_default_integration = HttpLambdaIntegration("BooksIntegration", book_store_default_fn) http_api = apigwv2.HttpApi(self, "HttpApi") http_api.add_routes( path="/books", methods=[apigwv2.HttpMethod.GET], integration=get_books_integration ) http_api.add_routes( path="/books", methods=[apigwv2.HttpMethod.ANY], integration=book_store_default_integration )
- Parameters:
id (
str) – id of the underlying integration construct.handler (
IFunction) – the Lambda handler to integrate with.parameter_mapping (
Optional[ParameterMapping]) – Specifies how to transform HTTP requests before sending them to the backend. Default: undefined requests are sent to the backend unmodifiedpayload_format_version (
Optional[PayloadFormatVersion]) – Version of the payload sent to the lambda handler. Default: PayloadFormatVersion.VERSION_2_0scope_permission_to_route (
Optional[bool]) – Scope the permission for invoking the AWS Lambda down to the specific route associated with this integration. If this is set tofalse, the permission will allow invoking the AWS Lambda from any route. This is useful for reducing the AWS Lambda policy size for cases where the same AWS Lambda function is reused for many integrations. Default: truetimeout (
Optional[Duration]) – The maximum amount of time an integration will run before it returns without a response. Must be between 50 milliseconds and 29 seconds. Default: Duration.seconds(29)
Methods
- bind(*, route, scope)
Bind this integration to the route.
- Parameters:
route (
IHttpRoute) – The route to which this is being bound.scope (
Construct) – The current scope in which the bind is occurring. If theHttpRouteIntegrationbeing bound creates additional constructs, this will be used as their parent scope.
- Return type: