HttpLambdaIntegrationProps

class aws_cdk.aws_apigatewayv2_integrations.HttpLambdaIntegrationProps(*, parameter_mapping=None, payload_format_version=None, scope_permission_to_route=None, timeout=None)

Bases: object

Lambda Proxy integration properties.

Parameters:
  • parameter_mapping (Optional[ParameterMapping]) – Specifies how to transform HTTP requests before sending them to the backend. Default: undefined requests are sent to the backend unmodified

  • payload_format_version (Optional[PayloadFormatVersion]) – Version of the payload sent to the lambda handler. Default: PayloadFormatVersion.VERSION_2_0

  • scope_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 to false, 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: true

  • timeout (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)

ExampleMetadata:

infused

Example:

from aws_cdk.aws_apigatewayv2_integrations import HttpLambdaIntegration

# books_default_fn: lambda.Function


http_api = apigwv2.HttpApi(self, "HttpApi")

get_books_integration = HttpLambdaIntegration("GetBooksIntegration", books_default_fn,
    scope_permission_to_route=False
)
create_book_integration = HttpLambdaIntegration("CreateBookIntegration", books_default_fn,
    scope_permission_to_route=False
)

http_api.add_routes(
    path="/books",
    methods=[apigwv2.HttpMethod.GET],
    integration=get_books_integration
)

http_api.add_routes(
    path="/books",
    methods=[apigwv2.HttpMethod.POST],
    integration=create_book_integration
)

Attributes

parameter_mapping

Specifies how to transform HTTP requests before sending them to the backend.

Default:

undefined requests are sent to the backend unmodified

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html

payload_format_version

Version of the payload sent to the lambda handler.

Default:

PayloadFormatVersion.VERSION_2_0

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

scope_permission_to_route

Scope the permission for invoking the AWS Lambda down to the specific route associated with this integration.

If this is set to false, 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:

true

timeout

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)