Experimental
@aws-cdk/aws-bedrock-agentcore-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
ApiGatewayTargetConfiguration Class
Configuration for API Gateway-based MCP targets.
This configuration connects your gateway to an Amazon API Gateway REST API stage. The gateway translates incoming MCP requests into HTTP requests to your REST API and handles response formatting.
Key considerations:
- API must be in the same account and region as the gateway
- Only REST APIs are supported (no HTTP or WebSocket APIs)
- API must use a public endpoint type
- Methods with both AWS_IAM authorization and API key requirements are not supported
- Proxy resources (e.g.,
/pets/{proxy+}) are not supported
Example
ts
// 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_apigateway as apigateway } from 'aws-cdk-lib';
declare const restApi: apigateway.RestApi;
const apiGatewayTargetConfiguration = new bedrock_agentcore_alpha.ApiGatewayTargetConfiguration({
apiGatewayToolConfiguration: {
toolFilters: [{
filterPath: 'filterPath',
methods: [bedrock_agentcore_alpha.ApiGatewayHttpMethod.GET],
}],
// the properties below are optional
toolOverrides: [{
method: bedrock_agentcore_alpha.ApiGatewayHttpMethod.GET,
name: 'name',
path: 'path',
// the properties below are optional
description: 'description',
}],
},
restApi: restApi,
// the properties below are optional
metadataConfiguration: {
allowedQueryParameters: ['allowedQueryParameters'],
allowedRequestHeaders: ['allowedRequestHeaders'],
allowedResponseHeaders: ['allowedResponseHeaders'],
},
stage: 'stage',
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha
from aws_cdk import aws_apigateway as apigateway
# rest_api: apigateway.RestApi
api_gateway_target_configuration = bedrock_agentcore_alpha.ApiGatewayTargetConfiguration(
api_gateway_tool_configuration=bedrock_agentcore_alpha.ApiGatewayToolConfiguration(
tool_filters=[bedrock_agentcore_alpha.ApiGatewayToolFilter(
filter_path="filterPath",
methods=[bedrock_agentcore_alpha.ApiGatewayHttpMethod.GET]
)],
# the properties below are optional
tool_overrides=[bedrock_agentcore_alpha.ApiGatewayToolOverride(
method=bedrock_agentcore_alpha.ApiGatewayHttpMethod.GET,
name="name",
path="path",
# the properties below are optional
description="description"
)]
),
rest_api=rest_api,
# the properties below are optional
metadata_configuration=bedrock_agentcore_alpha.MetadataConfiguration(
allowed_query_parameters=["allowedQueryParameters"],
allowed_request_headers=["allowedRequestHeaders"],
allowed_response_headers=["allowedResponseHeaders"]
),
stage="stage"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;
import software.amazon.awscdk.services.apigateway.*;
RestApi restApi;
ApiGatewayTargetConfiguration apiGatewayTargetConfiguration = ApiGatewayTargetConfiguration.Builder.create()
.apiGatewayToolConfiguration(ApiGatewayToolConfiguration.builder()
.toolFilters(List.of(ApiGatewayToolFilter.builder()
.filterPath("filterPath")
.methods(List.of(ApiGatewayHttpMethod.GET))
.build()))
// the properties below are optional
.toolOverrides(List.of(ApiGatewayToolOverride.builder()
.method(ApiGatewayHttpMethod.GET)
.name("name")
.path("path")
// the properties below are optional
.description("description")
.build()))
.build())
.restApi(restApi)
// the properties below are optional
.metadataConfiguration(MetadataConfiguration.builder()
.allowedQueryParameters(List.of("allowedQueryParameters"))
.allowedRequestHeaders(List.of("allowedRequestHeaders"))
.allowedResponseHeaders(List.of("allowedResponseHeaders"))
.build())
.stage("stage")
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;
using Amazon.CDK.AWS.APIGateway;
RestApi restApi;
var apiGatewayTargetConfiguration = new ApiGatewayTargetConfiguration(new ApiGatewayTargetConfigurationProps {
ApiGatewayToolConfiguration = new ApiGatewayToolConfiguration {
ToolFilters = new [] { new ApiGatewayToolFilter {
FilterPath = "filterPath",
Methods = new [] { ApiGatewayHttpMethod.GET }
} },
// the properties below are optional
ToolOverrides = new [] { new ApiGatewayToolOverride {
Method = ApiGatewayHttpMethod.GET,
Name = "name",
Path = "path",
// the properties below are optional
Description = "description"
} }
},
RestApi = restApi,
// the properties below are optional
MetadataConfiguration = new MetadataConfiguration {
AllowedQueryParameters = new [] { "allowedQueryParameters" },
AllowedRequestHeaders = new [] { "allowedRequestHeaders" },
AllowedResponseHeaders = new [] { "allowedResponseHeaders" }
},
Stage = "stage"
});
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"
import "github.com/aws/aws-cdk-go/awscdk"
var restApi RestApi
apiGatewayTargetConfiguration := bedrock_agentcore_alpha.NewApiGatewayTargetConfiguration(&ApiGatewayTargetConfigurationProps{
ApiGatewayToolConfiguration: &ApiGatewayToolConfiguration{
ToolFilters: []ApiGatewayToolFilter{
&ApiGatewayToolFilter{
FilterPath: jsii.String("filterPath"),
Methods: []ApiGatewayHttpMethod{
bedrock_agentcore_alpha.ApiGatewayHttpMethod_GET,
},
},
},
// the properties below are optional
ToolOverrides: []ApiGatewayToolOverride{
&ApiGatewayToolOverride{
Method: bedrock_agentcore_alpha.ApiGatewayHttpMethod_GET,
Name: jsii.String("name"),
Path: jsii.String("path"),
// the properties below are optional
Description: jsii.String("description"),
},
},
},
RestApi: restApi,
// the properties below are optional
MetadataConfiguration: &MetadataConfiguration{
AllowedQueryParameters: []*string{
jsii.String("allowedQueryParameters"),
},
AllowedRequestHeaders: []*string{
jsii.String("allowedRequestHeaders"),
},
AllowedResponseHeaders: []*string{
jsii.String("allowedResponseHeaders"),
},
},
Stage: jsii.String("stage"),
})
Initializer
ts
new ApiGatewayTargetConfiguration(props: ApiGatewayTargetConfigurationProps)
python
ApiGatewayTargetConfiguration(props: ApiGatewayTargetConfigurationProps)
java
new ApiGatewayTargetConfiguration(ApiGatewayTargetConfigurationProps props)
csharp
new ApiGatewayTargetConfiguration(ApiGatewayTargetConfigurationProps props)
go
NewApiGatewayTargetConfiguration(Props ApiGatewayTargetConfigurationProps)
Properties
apiGatewayToolConfigurationApiGatewayToolConfigurationapi_gateway_tool_configurationApiGatewayToolConfigurationapiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfiguration#Tool configuration for the API Gateway target.
metadataConfigurationmay be undefinedMetadataConfigurationmetadata_configurationmay be undefinedMetadataConfigurationmetadataConfigurationmay be undefinedMetadataConfigurationMetadataConfigurationmay be undefinedMetadataConfigurationMetadataConfigurationmay be undefinedMetadataConfiguration#Metadata configuration for the API Gateway target.
The ID of the REST API.
The stage name of the REST API.
targetTypeMcpTargetTypetarget_typeMcpTargetTypetargetTypeMcpTargetTypeTargetTypeMcpTargetTypeTargetTypeMcpTargetType#The target type.
Methods
bind(_scope: Construct, gateway: IGateway): TargetConfigurationConfigdef bind(self, _scope: Construct, gateway: IGateway) -> TargetConfigurationConfigpublic TargetConfigurationConfig bind(Construct _scope, IGateway gateway)public TargetConfigurationConfig Bind(Construct _scope, IGateway gateway)func Bind(_scope Construct, Gateway IGateway) TargetConfigurationConfig#Binds this configuration to a construct scope Sets up necessary permissions for the gateway to access the API Gateway.
2 parameters
Parameters
_scope_scope_scope_scope_scope— The construct scope.gatewaygatewaygatewaygatewayGateway— The gateway that will use this target.
create(props: ApiGatewayTargetConfigurationProps): ApiGatewayTargetConfiguration // chainable@staticmethod def create(props: ApiGatewayTargetConfigurationProps) -> ApiGatewayTargetConfigurationpublic static ApiGatewayTargetConfiguration create(ApiGatewayTargetConfigurationProps props)public static ApiGatewayTargetConfiguration Create(ApiGatewayTargetConfigurationProps props)func Create(Props ApiGatewayTargetConfigurationProps) ApiGatewayTargetConfigurationstatic#Create an API Gateway target configuration.
1 parameter · returns
Parameters
propspropspropspropsProps— The configuration properties.
Returns: A new ApiGatewayTargetConfiguration instance