class LambdaInterceptor
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.LambdaInterceptor |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#LambdaInterceptor |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.LambdaInterceptor |
Python | aws_cdk.aws_bedrock_agentcore_alpha.LambdaInterceptor |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป LambdaInterceptor |
Implements
IInterceptor
A Lambda-based interceptor for Gateway.
Interceptors allow you to run custom code during each invocation of your gateway:
- REQUEST interceptors execute before calling the target
- RESPONSE interceptors execute after the target responds
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
import { aws_lambda as lambda } from 'aws-cdk-lib';
declare const function_: lambda.Function;
const lambdaInterceptor = bedrock_agentcore_alpha.LambdaInterceptor.forRequest(function_, /* all optional props */ {
passRequestHeaders: false,
});
Properties
| Name | Type | Description |
|---|---|---|
| interception | Interception | The interception point (REQUEST or RESPONSE). |
interceptionPoint
Type:
Interception
The interception point (REQUEST or RESPONSE).
Methods
| Name | Description |
|---|---|
| bind(_scope, gateway) | Binds this Lambda interceptor to a Gateway. |
| static for | Create a REQUEST interceptor that executes before the gateway calls the target. |
| static for | Create a RESPONSE interceptor that executes after the target responds. |
bind(_scope, gateway)
public bind(_scope: Construct, gateway: IGateway): InterceptorBindConfig
Parameters
- _scope
Constructโ The construct scope (currently unused, reserved for future extensions). - gateway
IGatewayโ The gateway this interceptor is being bound to.
Returns
Binds this Lambda interceptor to a Gateway.
This method:
- Grants the Gateway's IAM role permission to invoke the Lambda function
- Returns the CloudFormation configuration for this interceptor
static forRequest(lambdaFunction, options?)
public static forRequest(lambdaFunction: IFunction, options?: InterceptorOptions): LambdaInterceptor
Parameters
- lambdaFunction
IFunctionโ The Lambda function to invoke. - options
Interceptorโ Optional configuration for the interceptor.Options
Returns
Create a REQUEST interceptor that executes before the gateway calls the target.
Important: When this interceptor is added to a gateway, the gateway's IAM role
will automatically be granted lambda:InvokeFunction permission on the specified
Lambda function.
static forResponse(lambdaFunction, options?)
public static forResponse(lambdaFunction: IFunction, options?: InterceptorOptions): LambdaInterceptor
Parameters
- lambdaFunction
IFunctionโ The Lambda function to invoke. - options
Interceptorโ Optional configuration for the interceptor.Options
Returns
Create a RESPONSE interceptor that executes after the target responds.
Important: When this interceptor is added to a gateway, the gateway's IAM role
will automatically be granted lambda:InvokeFunction permission on the specified
Lambda function.

.NET
Go
Java
Python
TypeScript (