Bedrock Builder
Note: This documentation is also available in a rendered format here.
Deploys secure AgentCore Harnesses and Gateways with Knowledge Bases, Vector Stores, Lambda functions, and Guardrails for building AI-powered conversational workflows. Common scenarios include building Q&A chatbots over internal documents, automating business workflows with AI agents, or adding retrieval-augmented generation to your applications.
Deployed Resources
This module deploys and integrates the following resources:
- KMS Key — Encrypts the module's Bedrock resources. Auto-generated if not provided in config.
- Lambda Functions (Optional) — Functions for gateway tools, gateway interceptors, and Knowledge Base custom transformations, referenced via
generated-function:. May be VPC-bound with configurable security groups. - Lambda Layers (Optional) — Shared code layers for Lambda functions.
- Knowledge Base(s) (Optional) — Bedrock Knowledge Bases with S3 and SharePoint data sources, multiple parsing strategies (default, BDA, Foundation Model, custom), and chunking configurations.
- Vector Store(s) (Optional) — OpenSearch Serverless collections or Aurora Serverless clusters for Knowledge Base vector storage.
- Bedrock Guardrail (Optional) — Content filters, contextual grounding, PII entity detection, and regex-based sensitive information filtering.
- Guardrail Intervention Alarms (Optional) — CloudWatch alarms on the interventions of each guardrail that sets
interventionAlarm, notifying an existing SNS topic or a module-created one, with SSM parameters for each alarm's name and ARN. See Guardrail intervention alarms. - Guardrail Alarm SNS Topic (Optional) — With
guardrailAlarms.createNotificationTopic, the SNS topic the guardrail alarms notify, with optional email subscriptions, its topic policy, and SSM parameters for its name and ARN. - AgentCore Harness(es) (Optional) — Declarative agent loops (model + system prompt + tools) on AgentCore.
- AgentCore Gateway(s) (Optional) — MCP servers exposing Lambda functions and knowledge bases to harnesses and other gateway clients as tools.
- Knowledge Base Gateway Connector(s) (Optional) — A Lambda connector per
knowledgeBasegateway target, exposing a knowledge base to gateway clients as aRetrievetool. See Knowledge bases through a gateway.

Related Modules
- Bedrock Settings — Configure Bedrock model invocation audit logging before deploying agents
- Bedrock AgentCore Runtime — Deploy custom agent runtimes as an alternative to declarative AgentCore Harnesses
- DataOps Lambda — Deploy Lambda functions independently that can be referenced as gateway targets via ARN
- Roles — Create IAM roles for harness, knowledge base, or Lambda function execution
Security/Compliance Details
This module is designed in alignment with MDAA security/compliance principles and CDK nag rulesets. Additional review is recommended prior to production deployment, ensuring organization-specific compliance requirements are met.
- Encryption at Rest:
- Bedrock resources encrypted with customer-managed KMS keys (auto-generated if not provided)
- OpenSearch Serverless collections use encryption-at-rest security policies
- Aurora Serverless clusters encrypted with KMS
- AgentCore Harness log groups encrypted with a customer-managed KMS key
- Knowledge base gateway connector environments and log groups encrypted with the module KMS key
- A module-created guardrail alarm topic is encrypted with the module KMS key
- Encryption in Transit:
- All Bedrock API communications use TLS
- OpenSearch and Aurora connections encrypted in transit
- Least Privilege:
- Lambda execution roles scoped to required services only
- OpenSearch Serverless uses data access policies for fine-grained control
- AgentCore Harness execution role scoped to its resolved model, guardrail, gateway, and image grants, with an
sts:AssumeRoledeny and a configurable tool allowlist - Each knowledge base gateway connector has its own role, allowed only
bedrock:Retrieveon one knowledge base and log writes to its own log group lambda:InvokeFunctionon a knowledge base gateway connector is granted to the gateway role only- A VPC-bound knowledge base gateway connector's role also gets the EC2 network interface actions Lambda needs to attach it, denied to the function's own code
- CloudWatch's publish grant on a module-created guardrail alarm topic, and its use of the module KMS key, are limited to this module's guardrail alarms
- Network Isolation:
- Lambda functions and Aurora clusters can be VPC-bound with configurable security groups
- Knowledge base gateway connectors run outside your VPC and call the regional
bedrock-agent-runtimeendpoint, unlessnetworkConfigurationplaces them in your subnets, reaching Retrieve through a VPC endpoint set; a harness in a private VPC reaches them only through its gateway endpoint - OpenSearch Serverless collections support VPC endpoints
- No public connectivity to VPC-bound resources
- AgentCore Harnesses run in mandatory VPC-only network mode, with module-managed VPC endpoints and a per-harness endpoint client security group when a harness references a
vpcEndpointsset - Module-managed VPC endpoints are a private network path, not an authorization boundary - the supporting service endpoints carry the AWS default policy, which permits their service in any account, so the harness execution role stays the control on what a session can reach. Created AgentCore Gateway, S3 image-layer and
bedrock-agent-runtimeendpoints carry scoped policies; thebedrock-agent-runtimepolicy allows onlybedrock:Retrieveon the knowledge bases the set's connectors query
- Content Safety:
- Guardrails provide content filters and contextual grounding checks
- PII entity detection and regex-based sensitive information filtering
- AgentCore Harness log groups apply an always-on PII masking floor, extensible via config
- Optional intervention count and rate alarms on each guardrail notify one SNS topic, such as a security team's
AWS Service Endpoints
VPC-bound resources in this module may need VPC endpoints where public AWS service connectivity is unavailable — private subnets without a NAT gateway, firewalled environments, or PrivateLink-only architectures. Some are created for you; the rest are yours to provision.
Created by this module:
| Needed by | Endpoint service | Type | Notes |
|---|---|---|---|
| AgentCore Harness | bedrock-runtime, ecr.api, ecr.dkr, sts, logs, bedrock-agentcore.gateway, s3 |
Interface + Gateway | Declared per VPC — see VPC endpoint sets. bedrock-agentcore.gateway only for a harness with a gateway tool |
| Knowledge base gateway connector | bedrock-agent-runtime |
Interface | Declared per VPC — see VPC endpoint sets. Only for a connector with networkConfiguration |
| OpenSearch Serverless vector store | service-managed OpenSearch Serverless endpoint | — | One per VPC. Reuse an existing one with the vector store's ossVpce, or a duplicate fails to deploy |
You provision:
| Needed by | Endpoint service | Type |
|---|---|---|
| Aurora vector store admin-password rotation | secretsmanager |
Interface |
| Your own VPC-bound Lambda function code | whatever it calls (lambda, kms, bedrock-runtime, s3, …) |
Interface / Gateway |
Aurora vector stores enable admin-password rotation unconditionally — every 60 days, not configurable from this module — and the rotation function runs in your VPC. Without a Secrets Manager endpoint or a NAT path it has no route to the API, and the failure is late and quiet: the stack deploys clean and rotation starts failing on the first scheduled run. Aurora itself needs no endpoint — it is reached through its ENIs in your subnets.
VPC endpoint sets
Give an AgentCore Harness's sessions, or a knowledge base gateway connector, a private outbound path by declaring a VPC endpoint set and referencing it:
vpcEndpoints:
agentcore-private:
vpcId: 'vpc-0123456789abcdef0'
subnetIds: ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1']
routeTableIds: ['rtb-0123456789abcdef0']
harnesses:
support-agent:
modelId: 'anthropic.claude-3-sonnet-20240229-v1:0'
systemPrompt: 'You are a helpful assistant.'
networkConfiguration:
securityGroups: ['sg-0123456789abcdef0']
subnets: ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1']
vpcEndpoints: 'agentcore-private'
That creates every endpoint the harness needs — bedrock-runtime, ecr.api, ecr.dkr, sts, logs, an S3 gateway endpoint for container image layers, plus bedrock-agentcore.gateway when the harness declares a gateway tool — and wires the harness to them. No service names or endpoint policies are configured, and no security group IDs unless you bring an endpoint that already exists (see below). A knowledge base connector references a set the same way, from its networkConfiguration, and needs only bedrock-agent-runtime — see Connectors in your VPC.
Which endpoints exist is derived from the consumers — harnesses and knowledge base connectors — never added by the set. A set only states which VPC it serves, where created endpoints go, and how each derived endpoint is reached. Every consumer referencing a set shares its endpoints (AWS allows one Private DNS interface endpoint per service per VPC), and each consumer is wired only to the endpoints it needs from its own client security group. A consumer that omits vpcEndpoints gets nothing. Remove a set in the same change as the last consumer referencing it: a declared set nothing references is a synth error, not a clean teardown.
The three states of an endpoint
Each endpoint property is optional, and which fields you set chooses its state:
| State | How to write it | What happens |
|---|---|---|
| created | omit it, or set neither | Created in the set's subnetIds, with its own security group |
| brought | securityGroupId: 'sg-…' |
Not created. Consumers are granted HTTPS egress to that group, and one ingress rule is added to it — the endpoint's id isn't needed, and its policy stays as its owner wrote it |
| external | external: true |
Neither created nor wired. Reached over NAT, or through an endpoint whose security group you'd rather not name |
vpcEndpoints:
agentcore-private:
vpcId: 'vpc-0123456789abcdef0'
subnetIds: ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1']
routeTableIds: ['rtb-0123456789abcdef0']
ecrApi:
subnetIds: ['subnet-0123456789abcdef0'] # created, one AZ only
sts:
securityGroupId: 'sg-0centralstsvpce01' # exists already
logs:
external: true # stays on the VPC's existing path
The endpoint properties are bedrockRuntime, ecrApi, ecrDocker, sts, logs, agentCoreGateway, bedrockAgentRuntime, and s3ImageLayers. s3ImageLayers takes only external — a gateway endpoint has no security group to wire, and its placement comes from the set's routeTableIds.
Container image layers
Image layers are served from the ECR layer bucket over S3, so the ECR endpoints alone cannot complete a pull. A set a harness references must therefore state one of:
routeTableIds— create an S3 gateway endpoint on those route tables. List the route table of every subnet the referencing harnesses run in: private subnets often each have their own, and a session in a subnet whose table lacks the endpoint's route can't pull image layers. It intercepts all S3 traffic from every subnet on them, and its derived policy allows only the image-layer read, so if other workloads share those tables and need broader S3 access, use the option below instead and provision the endpoint out of band.s3ImageLayers: { external: true }— S3 is already reachable, over NAT or an endpoint provisioned elsewhere. Required for a VPC that already has an S3 gateway endpoint on those route tables: a route table carries a service's prefix-list route from only one endpoint, so a second fails at deploy.
Stating neither is a synth error, because a no-NAT VPC without image-layer access deploys cleanly and its sessions never start. A set only knowledge base connectors reference states neither: connectors pull no images.
Rejected at synth
- Both
routeTableIdsands3ImageLayers.external, or neither, on a set a harness references; either on a set no harness references. externaltogether withsecurityGroupId, orsubnetIdson an endpoint that is brought or external.- An endpoint property no consumer of the set requires:
agentCoreGatewaywhen no referencing harness declares a gateway tool,bedrockAgentRuntimewhen no knowledge base connector references the set, and the harness endpoints (bedrockRuntime,ecrApi,ecrDocker,sts,logs) when no harness references it. - Two sets naming the same
vpcId, or set names differing only in case. - A harness or connector referencing an undeclared set, or a set nothing references. A
knowledgeBasegateway target counts only once a gateway registers it. - A connector
securityGroupIdwhen the set providesbedrockAgentRuntime, or none when the set marks it external.
Not in the same VPC as an AgentCore Runtime's supporting endpoints
A set's endpoints are owned once per VPC. The bedrock-agentcore-runtime module instead provisions its supporting endpoints per runtime, through networkConfiguration.vpcEndpoint.createSupportingEndpoints, and both cover ecr.api, ecr.dkr, sts and logs. Only one Private DNS endpoint per service per VPC is allowed, so whichever deploys second fails mid-deploy on the duplicate. Keep a set and a createSupportingEndpoints runtime in different VPCs, or turn that flag off and let the set serve both.
One constraint to plan for
An interface endpoint takes at most one subnet per availability zone. Since a set's subnetIds is explicit, that's yours to get right — the endpoints don't have to sit in the same subnets as your sessions, and covering fewer zones costs less in endpoint ENI hours and more in cross-zone data.
Knowledge bases through a gateway
A knowledgeBase gateway target exposes a Bedrock knowledge base to gateway clients, such as an AgentCore Harness, as a Retrieve tool:
gatewayTargets:
support-kb:
targetConfiguration:
knowledgeBase:
id: 'config:kb-test-customer-support'
description: 'Search customer support and product documentation.'
numberOfResults: 5 # optional, 1-100
overrideSearchType: HYBRID # optional, HYBRID | SEMANTIC
For each target the module deploys a Lambda connector, with its own execution role and log group, that calls Retrieve on the knowledge base, and registers it as a Lambda gateway target.
id-config:<name>for a knowledge base in this module'sknowledgeBasesmap, or the 10-character id of a knowledge base in the same account and region, as a literal or anssm:reference. A knowledge base ARN is rejected at synth.description- the tool description the model sees. The target-leveldescriptionis target metadata only.- Tool name - the model sees
<target name>___Retrieve, where the prefix is the deployed (MDAA-named) gateway target name, not the config key. A harnessallowedToolsentry@<harness tool key>(for example@kb_tools) allows every tool on that gateway, including this one. - Contract - the same input and output as the
Retrievetool of AgentCore Gateway's Managed Knowledge Bases connector: inputretrievalQuery.text(up to 20,000 characters), output{"retrievalResults": [...]}with the Retrieve items unchanged, except that:- an image result's inline
content.byteContentis dropped; itstypeandlocationremain; - results past 4 MB of serialized output are dropped, keeping the most relevant, so the response stays within the gateway's 6 MB tool-call payload limit.
- an image result's inline
- Errors - a failed call returns a tool error (
isError: true); the details are in the connector's log group. The connector's message says whether to rephrase the query, retry later, or stop, but the gateway passes it through only withexceptionLevel: DEBUG. At the default level, callers get the gateway's generic error message instead. - Your own connector - to use your own retrieval code instead, register your function as a
lambdagateway target with its own tool schema.
Connectors in your VPC
Set networkConfiguration to run a connector in your subnets, for example where an organization policy requires VPC-bound Lambda functions, or a data perimeter policy requires aws:SourceVpc or aws:SourceVpce on bedrock:Retrieve. The connector reaches Retrieve through a VPC endpoint set:
vpcEndpoints:
kb-private:
vpcId: 'vpc-0123456789abcdef0'
subnetIds: ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1']
gatewayTargets:
support-kb:
targetConfiguration:
knowledgeBase:
id: 'config:kb-test-customer-support'
description: 'Search customer support and product documentation.'
networkConfiguration:
subnets: ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1']
vpcEndpoints: 'kb-private'
- The set creates the
bedrock-agent-runtimeendpoint, and the module creates the connector's security group with HTTPS access to it. The connector needs no other endpoint: Lambda delivers its logs and decrypts its environment outside your VPC. - The created endpoint's policy allows only
bedrock:Retrieve, on the knowledge bases the set's connectors query. Its Private DNS name serves the whole VPC, so other workloads there callingbedrock-agent-runtime(RetrieveAndGenerate,InvokeAgent, …) are denied through it. For such a VPC, bring the existing endpoint (bedrockAgentRuntime.securityGroupId) or mark itexternal: true. - When the set marks
bedrockAgentRuntimeexternal, there is no endpoint to wire, so set the connector'snetworkConfiguration.securityGroupIdto a security group that allows HTTPS to wherever Retrieve is reached. - Omit
networkConfigurationto run the connector outside your VPC.
Guardrail intervention alarms
Set interventionAlarm on a guardrail to alarm when it intervenes more than expected, and the module-level guardrailAlarms block to say where every guardrail alarm in the module notifies:
guardrails:
enterprise-guardrail:
contentFilters: { ... }
interventionAlarm:
countThreshold: 25 # interventions per period
ratePercentThreshold: 15 # percent of evaluations that intervened
guardrailAlarms:
notificationTopicArn: 'arn:{{partition}}:sns:{{region}}:{{account}}:security-alerts'
periodSeconds: 300 # optional
evaluationPeriods: 3 # optional
datapointsToAlarm: 2 # optional
- What is counted - Bedrock publishes
InvocationsIntervenedin theAWS/Bedrock/Guardrailsnamespace per guardrail ARN and version. Each alarm aggregates every version of the guardrail,DRAFTincluded, with a CloudWatch Metrics Insights query, so it counts traffic whichever version a caller invokes. Inline use (Converse, ConverseStream, and InvokeModel with a guardrail) is counted as well asApplyGuardrail, although the AWS guardrail metrics documentation describes the metric only in terms ofApplyGuardrail. - Count and rate -
countThresholdis compared to the number of interventions in a period, andratePercentThresholdto the percentage of guardrail evaluations that intervened. An inline call is evaluated on its input and, if the input passes, again on its output, so it is one or two evaluations. Set either or both. - Low traffic - in a period with few evaluations one intervention is a large share: one intervention in a period with a single evaluation is 100%. On a low-traffic guardrail, require several breaching periods with
datapointsToAlarm, or usecountThresholdinstead ofratePercentThreshold. - No per-direction or per-policy alarm - Bedrock publishes the input/output and policy-type breakdowns only account-wide, so an alarm on one guardrail can't be limited to input-side interventions or to one policy type.
- Notification - every guardrail alarm in the module notifies one target: an existing topic (
notificationTopicArn), or a topic the module creates, encrypted with the module KMS key (createNotificationTopic, withnotificationEmailsto subscribe addresses). WithkmsKeyArnset, usenotificationTopicArn: the module can't grant CloudWatch use of an imported key, socreateNotificationTopicis rejected at synth. - Evaluation window -
periodSecondsmust be a multiple of 60, andperiodSecondsxevaluationPeriodsmust not exceed 3 hours, because CloudWatch evaluates Metrics Insights alarms over the most recent 3 hours only. Both are checked at synth. - Quota - each threshold is one Metrics Insights alarm. An account can have 200 Metrics Insights alarms per Region, and that quota can't be raised.
Configuration
MDAA Config
Add the following snippet to your mdaa.yaml under the modules: section of a domain/env in order to use this module:
bedrock-builder: # Module Name can be customized
module_path: '@aws-mdaa/bedrock-builder' # Must match module NPM package name
module_configs:
- ./bedrock-builder.yaml # Filename/path can be customized
Module Config Samples and Variants
Copy the contents of the relevant sample config below into the ./bedrock-builder.yaml file referenced in the MDAA config snippet above.
Minimal Configuration
Deploys a single AgentCore Harness - a declarative agent loop (foundation model + system prompt) configured via the top-level harnesses map. Sets only the mandatory fields (model, system prompt, VPC network configuration) and takes the default path for everything else. Start here for a quick proof-of-concept agent before adding tools, knowledge bases, or guardrails.
# Contents available via above link
# Minimal Bedrock Builder configuration for an AgentCore Harness - a declarative agent loop
# (foundation model + system prompt). Harnesses are configured via the top-level `harnesses` map.
#
# This config sets only the mandatory fields and takes the default path for everything else: an
# MDAA-created execution role, AWS IAM (SigV4) inbound auth, the AWS-managed harness container, no
# tools, and the service-default model sampling, lifecycle, and truncation behavior. See
# sample-config-comprehensive.yaml for a harness exercising the optional features.
# See CONFIGURATION.md for role reference options (name, arn, id). Admin roles are granted key-admin
# rights on the module's KMS key (used here for the harness's log-group encryption).
dataAdminRoles:
- name: 'Admin'
# AgentCore Harness configurations, keyed by harness name.
harnesses:
minimal-harness:
# Required: foundation model identifier for the agent loop (on-demand id, inference-profile id, or
# full ARN).
modelId: 'anthropic.claude-3-sonnet-20240229-v1:0'
# Required: system prompt defining the agent's behavior.
systemPrompt: 'You are a helpful assistant.'
# Required: MDAA enforces VPC network isolation for the harness runtime (NetworkMode: VPC) - there
# is no public-network option. Supply the security groups and subnets (1-16 each) that run the
# harness's runtime sessions in your VPC.
networkConfiguration:
securityGroups:
- 'sg-0123456789abcdef0'
subnets:
- 'subnet-0123456789abcdef0'
Comprehensive Configuration
Deploys a customer support agent end to end: knowledge bases backed by Aurora and OpenSearch vector stores with S3/SharePoint data sources and multiple parsing and chunking strategies, Lambda functions, a guardrail with intervention alarms, an AgentCore Gateway serving a Lambda tool and a knowledge base, shared VPC endpoints, and an AgentCore Harness with production settings - JWT auth, a guardrail, a tool allowlist, private networking, PII masking, log retention, and a pinned endpoint. Use this as a reference for a production deployment and for the full harness, knowledge base, and guardrail option surface.
sample-config-comprehensive.yaml
# Contents available via above link
# Sample config for the Bedrock Builder module.
# Deploys a customer support agent end to end: knowledge bases backed
# by Aurora and OpenSearch vector stores, with S3/SharePoint data
# sources and multiple parsing and chunking strategies; Lambda
# functions; a guardrail with intervention alarms; an AgentCore
# Gateway serving a Lambda tool and a knowledge base; shared VPC
# endpoints; and an AgentCore Harness with production settings (JWT
# auth, guardrail, tool allowlist, private networking, PII masking,
# log retention, pinned endpoint).
#
# Alternatives to choices made here are shown elsewhere: an
# existing kmsKeyArn (sample-config-kb-only.yaml); a
# bring-your-own harness role, a literal guardrail id, and the
# sliding_window truncation strategy (construct unit tests); and
# gateway variants (sample-config-gateway-iam.yaml,
# sample-config-gateway-jwt.yaml).
# See CONFIGURATION.md for role reference options (name, arn, id).
# Admin roles granted key-admin access to the KMS key the module
# creates (unused when kmsKeyArn supplies an existing key).
# Roles can be referenced by name, arn, or id.
dataAdminRoles:
- name: 'Admin'
- arn: 'arn:{{partition}}:iam::{{account}}:role/ReadOnlyAdmin'
# (Optional) Lambda functions and layers, referenced from gateway
# targets, gateway interceptors, and knowledge base custom
# transformations via `generated-function:<name>`.
lambdaFunctions:
# (Optional) List of Lambda layers to create
layers:
# Layer name
- layerName: test-layer
# Source code directory path containing layer code
src: ./src/layer/
# (Optional) Layer description
description: 'test layer'
# (Optional) If true, src is expected to contain a Dockerfile
# for building the layer
dockerBuild: false
# (Optional) List of Lambda function definitions
functions:
# Lambda function name
- functionName: test-function
# (Optional) Optional function description
description: 'Lambda function exercising the optional function settings'
# Source code directory path containing Lambda function code
srcDir: ./src/function
# Lambda function handler (e.g., 'index.handler')
handler: test.lambda_handler
# Lambda runtime (e.g., python3.14, nodejs24.x)
runtime: python3.14
# IAM role ARN for Lambda function execution
roleArn: 'arn:{{partition}}:iam::{{account}}:role/test-lambda-role'
# (Optional) Memory allocation in MB (128-10240)
memorySizeMB: 256
# (Optional) Function timeout in seconds
timeoutSeconds: 60
# (Optional) The size of the function's /tmp directory in MB
# (default: 512 MiB)
ephemeralStorageSizeMB: 1024
# (Optional) Reserved concurrent executions for capacity
# management
reservedConcurrentExecutions: 10
# (Optional) Maximum retry attempts for failed executions
# (0-2)
retryAttempts: 2
# (Optional) Maximum event age in seconds (60-21600)
maxEventAgeSeconds: 3600
# (Optional) When true, srcDir must contain a Dockerfile for
# container image deployment
dockerBuild: false
# (Optional) Environment variables for function configuration
environment:
ENV_VAR_1: 'value1'
ENV_VAR_2: 'value2'
# (Optional) Generated layer names to attach to the function
generatedLayerNames:
- test-layer
# (Optional) Existing layer version ARNs mapped by name
layerArns:
external-layer: 'arn:{{partition}}:lambda:{{region}}:{{account}}:layer:ext-layer:1'
# (Optional) Principal ARN granted Lambda invoke permissions
grantInvoke: 'arn:{{partition}}:iam::{{account}}:role/invoker-role'
# (Optional) Additional resource permissions mapped by SID
additionalResourcePermissions:
crossAccountInvoke:
# AWS principal ARN for Lambda function access
principal: 'arn:{{partition}}:iam::{{account}}:role/cross-account-role'
# Lambda action (e.g., lambda:InvokeFunction)
action: lambda:InvokeFunction
# (Optional) Optional source account restriction for
# cross-account security
sourceAccount: '{{account}}'
# (Optional) Optional source resource ARN restriction for
# fine-grained access control
sourceArn: 'arn:{{partition}}:s3:::test-source-bucket'
# (Optional) VPC configuration for network deployment
vpcConfig:
# VPC ID for Lambda function deployment
vpcId: vpc-testvpc
# Subnet IDs for Lambda function ENI placement
subnetIds:
- subnet-test1
- subnet-test2
# (Optional) Optional security group ID. If omitted, a new
# security group is created.
securityGroupId: sg-test123
# (Optional) Optional egress rules for the Lambda function
# security group
securityGroupEgressRules:
# (Optional) IPv4 CIDR block rules
ipv4:
# CIDR block specification for network access control
- cidr: 10.0.0.0/16
# IP protocol (e.g., tcp, udp)
protocol: tcp
# Port number
port: 443
# (Optional) The ending port number for a port range
toPort: 443
# (Optional) Description of the rule
description: 'Allow HTTPS egress'
# (Optional) CDK Nag rule suppressions for this
# specific security group rule
suppressions:
- id: AwsSolutions-EC23
reason: 'Test CIDR egress rule suppression'
# (Optional) Prefix list rules
prefixList:
# Prefix list identifier for managed IP range access
- prefixList: pl-test123
protocol: tcp
port: 443
# (Optional) The ending port number for a port range
toPort: 443
# (Optional) Description of the rule
description: 'Allow HTTPS via prefix list'
# (Optional) CDK Nag rule suppressions for this
# specific security group rule
suppressions:
- id: AwsSolutions-EC23
reason: 'Test prefix list egress rule suppression'
# (Optional) Security group rules for cross-security
# group traffic
sg:
# Security group identifier
- sgId: sg-peer123
protocol: tcp
port: 5432
# (Optional) The ending port number for a port range
toPort: 5432
# (Optional) Description of the rule
description: 'Allow PostgreSQL to peer SG'
# (Optional) CDK Nag rule suppressions for this
# specific security group rule
suppressions:
- id: AwsSolutions-EC23
reason: 'Test SG peer egress rule suppression'
# (Optional) EventBridge configuration for event-driven
# execution
eventBridge:
# (Optional) Maximum age in seconds that EventBridge will
# attempt to deliver an event (60-86400)
maxEventAgeSeconds: 3600
# (Optional) Maximum number of retry attempts EventBridge
# will make (0-185)
retryAttempts: 3
# (Optional) Collection of named S3 EventBridge rules
s3EventBridgeRules:
test-s3-rule:
# Array of S3 bucket names that trigger the rule
buckets:
- test-source-bucket
# (Optional) Array of S3 object key prefixes for
# filtering
prefixes:
- incoming/
# (Optional) ARN of the custom EventBridge event bus
eventBusArn: 'arn:{{partition}}:events:{{region}}:{{account}}:event-bus/test-bus'
# (Optional) Collection of named general EventBridge rules
eventBridgeRules:
test-schedule-rule:
# (Optional) Human-readable description of the rule
description: 'Scheduled processing rule'
# (Optional) Schedule expression for time-based
# triggering (cron or rate syntax)
scheduleExpression: 'rate(1 hour)'
test-event-pattern-rule:
# (Optional) Human-readable description of the rule
description: 'Event pattern based rule'
# (Optional) ARN of the custom EventBridge event bus
eventBusArn: 'arn:{{partition}}:events:{{region}}:{{account}}:event-bus/test-bus'
# (Optional) EventBridge event pattern for rule
# matching and filtering
eventPattern:
# (Optional) Service that sourced the event
source:
- 'aws.s3'
# (Optional) Identifies the fields and values in
# the detail field
detailType:
- 'Object Created'
# (Optional) The 12-digit number identifying an
# AWS account
account:
- '{{account}}'
# (Optional) AWS region where the event originated
region:
- '{{region}}'
# (Optional) ARNs that identify resources involved
# in the event
resources:
- 'arn:{{partition}}:s3:::test-bucket'
# (Optional) Event timestamp
time:
- '2024-01-01T00:00:00Z'
# (Optional) Event version (default: 0)
version:
- '0'
# (Optional) Unique event identifier for tracing
id:
- 'test-event-id'
# (Optional) A JSON object at the discretion of the
# service originating the event
detail:
bucket:
name:
- test-bucket
# (Optional) Custom input payload for the rule target
input: '{"action": "process"}'
# (Optional) CloudWatch metric filters for custom metric
# extraction
metricFilters:
# Unique name for the metric filter
- filterName: error-filter
# CloudWatch Logs filter pattern for matching log events
filterPattern: 'ERROR'
# Metric transformations defining how matched data is
# converted to metrics
metricTransformations:
# CloudWatch metric name for the transformed metric
- metricName: ErrorCount
# CloudWatch metric namespace for metric organization
metricNamespace: TestApp/Errors
# Metric value extraction pattern
metricValue: '1'
# (Optional) Default value when filter pattern does
# not match
defaultValue: 0
# (Optional) CloudWatch metric unit
unit: Count
# (Optional) Metric dimensions for segmentation
dimensions:
FunctionName: '{{functionName}}'
# (Optional) CloudWatch alarms for monitoring and alerting
alarms:
# Unique name for the alarm
- alarmName: test-error-alarm
# Comparison operator
comparisonOperator: GreaterThanOrEqualToThreshold
# Number of consecutive periods the metric must breach
evaluationPeriods: 3
# Threshold value for alarm comparison
threshold: 5
# (Optional) Human-readable alarm description
alarmDescription: 'Alert on high error rate'
# (Optional) Whether alarm actions are enabled during
# state changes
actionsEnabled: true
# (Optional) SNS topic ARNs for ALARM state notifications
alarmActions:
- 'arn:{{partition}}:sns:{{region}}:{{account}}:test-alarm-topic'
# (Optional) SNS topic ARNs for OK state notifications
okActions:
- 'arn:{{partition}}:sns:{{region}}:{{account}}:test-ok-topic'
# (Optional) SNS topic ARNs for INSUFFICIENT_DATA state
# notifications
insufficientDataActions:
- 'arn:{{partition}}:sns:{{region}}:{{account}}:test-insufficient-topic'
# (Optional) Metric name for single metric alarms
metricName: ErrorCount
# (Optional) Metric namespace. AWS/* namespaces bypass
# validation.
namespace: TestApp/Errors
# (Optional) Evaluation period in seconds
period: 300
# (Optional) Statistic for metric aggregation
statistic: Sum
# (Optional) Datapoints that must breach threshold
# (M out of N evaluation)
datapointsToAlarm: 2
# (Optional) Missing data treatment (notBreaching,
# breaching, ignore, missing)
treatMissingData: notBreaching
# (Optional) CloudWatch metric unit
unit: Count
# (Optional) Metric dimensions. Supports
# {{functionName}} placeholder.
dimensions:
FunctionName: '{{functionName}}'
# Alarm using metric math (mutually exclusive with
# metricName in the same alarm)
- alarmName: test-math-alarm
comparisonOperator: GreaterThanThreshold
evaluationPeriods: 1
threshold: 100
# (Optional) Metric data queries for metric math alarms.
# Mutually exclusive with metricName.
metrics:
# Unique identifier for the query
- id: m1
# (Optional) CloudWatch metric name. Mutually
# exclusive with expression.
metricName: Invocations
# (Optional) CloudWatch metric namespace
namespace: AWS/Lambda
# (Optional) Evaluation period in seconds
period: 300
# (Optional) Statistic for metric aggregation
statistic: Sum
# (Optional) Whether this metric data should be
# returned in query results
returnData: false
# (Optional) Human-readable label
label: 'Total Invocations'
# (Optional) CloudWatch metric unit
unit: Count
# (Optional) Metric dimensions for filtering
dimensions:
FunctionName: '{{functionName}}'
- id: m2
metricName: Errors
namespace: AWS/Lambda
period: 300
statistic: Sum
returnData: false
- id: error_rate
# (Optional) Metric math expression. Mutually
# exclusive with metricName.
expression: '(m2/m1)*100'
# (Optional) Human-readable label
label: 'Error Rate %'
returnData: true
# (Optional) CloudWatch Logs Insights saved queries for log
# analysis
logInsightsQueries:
# Unique name for the saved query
- queryName: error-query
# CloudWatch Logs Insights query string
queryString: |
fields @timestamp, @message
| filter @message like /ERROR/
| sort @timestamp desc
# (Optional) Optional log group names for cross-function
# queries. Defaults to the function's log group.
logGroupNames:
- /aws/lambda/test-function
- functionName: test-custom-transformer
srcDir: ./src/function
handler: test.lambda_handler
runtime: python3.14
roleArn: 'arn:{{partition}}:iam::{{account}}:role/test-lambda-role'
description: For custom parsing and chunking logic
- functionName: test-gateway-interceptor
srcDir: ./src/function
handler: test.lambda_handler
runtime: python3.14
roleArn: 'arn:{{partition}}:iam::{{account}}:role/test-lambda-role'
description: Gateway REQUEST interceptor
grantInvoke: 'arn:{{partition}}:iam::{{account}}:role/role-in-another-account'
# (Optional) Vector store configurations for knowledge bases
# (OpenSearch Serverless or Aurora). Provides vector database
# storage for semantic search and retrieval-augmented generation.
vectorStores:
test-vector-store:
# (Optional) Vector store type
# (enum: AURORA_SERVERLESS, OPENSEARCH_SERVERLESS)
vectorStoreType: 'AURORA_SERVERLESS'
# VPC ID for vector store network isolation
vpcId: test-vpc-id
# Subnet IDs for vector store deployment
subnetIds:
- 'test-subnet-id1'
- 'test-subnet-id2'
# (Optional) Minimum Aurora Capacity Units for serverless
# scaling (enum: 1, 2, 4, 8, 16, 32, 64, 128, 192, 256, 384)
minCapacity: 1
# (Optional) Maximum Aurora Capacity Units for serverless
# scaling (enum: 1, 2, 4, 8, 16, 32, 64, 128, 192, 256, 384)
maxCapacity: 8
# (Optional) PostgreSQL engine version
engineVersion: '16.13'
# (Optional) Database port for Aurora PostgreSQL connectivity
port: 5432
test-vector-store2:
# (Optional) Vector store type
# (enum: AURORA_SERVERLESS, OPENSEARCH_SERVERLESS)
vectorStoreType: 'OPENSEARCH_SERVERLESS'
vpcId: test-vpc-id
subnetIds:
- 'test-subnet-id1'
- 'test-subnet-id2'
# Standby replica configuration
# (enum: DISABLE, ENABLE)
standbyReplicas: ENABLE
# (Optional) Existing OpenSearch Serverless VPC endpoint
ossVpce:
# Existing VPC endpoint ID
vpceId: 'vpce-0123456789abcdef0'
# Security group ID associated with the VPC endpoint
securityGroupId: 'sg-0123456789abcdef0'
# (Optional) Knowledge base configurations with S3/SharePoint data
# sources and custom parsing strategies. Enables document ingestion,
# embedding generation, and retrieval for RAG applications.
knowledgeBases:
test-knowledge-base:
# Bedrock embedding model ID for vector generation
embeddingModel: 'amazon.titan-embed-text-v2:0'
# Vector store reference name
vectorStore: test-vector-store
# (Optional) Vector field size for embedding dimensionality
vectorFieldSize: 1024
# IAM role reference for knowledge base execution
role:
id: generated-role-id:kb-execution-role
# (Optional) Supplemental S3 bucket for advanced parsing
# workflows. For multimodal documents, mandatory to provide
# location to store images extracted from your data source.
supplementalBucketName: 'supplemental-image-storage-bucket'
# (Optional) S3 data sources for cloud document integration
s3DataSources:
test-ds-default-parsing:
# S3 bucket name containing source documents
bucketName: 'customer-docs-bucket'
# (Optional) S3 key prefix to scope document ingestion
prefix: 'support-documents/'
# (Optional) Enable automatic data source sync
# (default: false)
enableSync: true
# (Optional) Enable multi-account sync (default: false)
enableMultiSync: true
# (Optional) IAM role ARN for sync Lambda
syncLambdaRoleArn: 'arn:{{partition}}:iam::{{account}}:role/test-sync-role'
test-ds-bda-parsing:
bucketName: 'customer-docs-bucket'
prefix: 'support-documents-2/'
# (Optional) Vector ingestion configuration for parsing
# and chunking
vectorIngestionConfiguration:
# (Optional) Parsing configuration for document
# processing
parsingConfiguration:
# Parsing strategy
# (enum: BEDROCK_DATA_AUTOMATION,
# BEDROCK_FOUNDATION_MODEL)
parsingStrategy: 'BEDROCK_DATA_AUTOMATION'
# (Optional) Bedrock Data Automation parsing config
bedrockDataAutomationConfiguration:
# Parsing modality for multimodal data processing
parsingModality: 'MULTIMODAL'
# (Optional) Chunking configuration for the data source
chunkingConfiguration:
# Chunking strategy
# (enum: FIXED_SIZE, HIERARCHICAL, NONE, SEMANTIC)
chunkingStrategy: 'FIXED_SIZE'
# (Optional) Fixed size chunking configuration
fixedSizeChunkingConfiguration:
# Maximum token count per chunk
maxTokens: 512
# Overlap percentage between adjacent chunks
overlapPercentage: 20
# Data source with hierarchical chunking strategy
test-ds-hierarchical-chunking:
bucketName: 'customer-docs-bucket'
prefix: 'support-documents-hierarchical/'
vectorIngestionConfiguration:
chunkingConfiguration:
chunkingStrategy: 'HIERARCHICAL'
# (Optional) Hierarchical chunking configuration
hierarchicalChunkingConfiguration:
# Token overlap between hierarchical chunks
overlapTokens: 50
# Hierarchical chunking level configurations
levelConfigurations:
# Maximum token count for this hierarchical level
- maxTokens: 1024
- maxTokens: 256
# Data source with semantic chunking strategy
test-ds-semantic-chunking:
bucketName: 'customer-docs-bucket'
prefix: 'support-documents-semantic/'
vectorIngestionConfiguration:
chunkingConfiguration:
chunkingStrategy: 'SEMANTIC'
# (Optional) Semantic chunking configuration
semanticChunkingConfiguration:
# Breakpoint percentile threshold for semantic
# boundary detection
breakpointPercentileThreshold: 95
# Buffer size for semantic context preservation
bufferSize: 1
# Maximum token count per semantic chunk
maxTokens: 300
test-ds-foundation-model-parsing:
bucketName: 'customer-docs-bucket'
prefix: 'support-documents-3/'
vectorIngestionConfiguration:
parsingConfiguration:
parsingStrategy: 'BEDROCK_FOUNDATION_MODEL'
# (Optional) Bedrock Foundation Model parsing config
bedrockFoundationModelConfiguration:
# Foundation model ARN for document parsing
modelArn: 'anthropic.claude-3-sonnet-20240229-v1:0'
# (Optional) Parsing modality for multimodal
# foundation model processing
parsingModality: 'MULTIMODAL'
# (Optional) Custom parsing instructions for the
# foundation model
parsingPromptText: 'Extract key information from this document'
test-ds-custom-parsing:
bucketName: 'customer-docs-bucket'
prefix: 'support-documents-4/'
vectorIngestionConfiguration:
parsingConfiguration:
parsingStrategy: 'BEDROCK_DATA_AUTOMATION'
bedrockDataAutomationConfiguration:
parsingModality: 'MULTIMODAL'
chunkingConfiguration:
chunkingStrategy: 'NONE'
# (Optional) Custom transformation configuration for
# data being ingested into the knowledge base
customTransformationConfiguration:
# S3 bucket for intermediate storage
intermediateStorageBucket: 'custom-transform-intermediate-bucket'
# S3 prefix for intermediate storage
intermediateStoragePrefix: 'path/to/data/objects'
# Lambda for custom transformation (exactly one). A plain
# Lambda ARN or `generated-function:<name>`.
transformLambdaArns:
- generated-function:test-custom-transformer
# (Optional) SharePoint data sources for enterprise document
# integration
sharepointDataSources:
test-sharepoint-ds-default-parsing:
# SharePoint data source connection configuration
dataSource:
# Authentication type
authType: OAUTH2_SHAREPOINT_APP_ONLY_CLIENT_CREDENTIALS
# Secrets Manager ARN for SharePoint credentials
credentialsSecretArn: 'arn:{{partition}}:secretsmanager:{{region}}:{{account}}:secret:/test/sharepoint/secret-qeTtB0'
# SharePoint domain
domain: mycompany.sharepoint.com
# SharePoint host type
hostType: ONLINE
# SharePoint site URLs to ingest
siteUrls:
- 'https://mycompany.sharepoint.com/sites/mysite'
# Azure AD tenant ID
tenantId: '2b5901be-9f28-4fa4-b565-706cbbc699c5'
test-sharepoint-ds-bda-parsing:
dataSource:
authType: OAUTH2_SHAREPOINT_APP_ONLY_CLIENT_CREDENTIALS
credentialsSecretArn: 'arn:{{partition}}:secretsmanager:{{region}}:{{account}}:secret:/test/sharepoint/secret-qeTtB0'
domain: mycompany.sharepoint.com
hostType: ONLINE
siteUrls:
- 'https://mycompany.sharepoint.com/sites/mysite'
tenantId: '2b5901be-9f28-4fa4-b565-706cbbc699c5'
vectorIngestionConfiguration:
parsingConfiguration:
parsingStrategy: 'BEDROCK_DATA_AUTOMATION'
bedrockDataAutomationConfiguration:
parsingModality: 'MULTIMODAL'
chunkingConfiguration:
chunkingStrategy: 'FIXED_SIZE'
fixedSizeChunkingConfiguration:
maxTokens: 512
overlapPercentage: 20
test-sharepoint-ds-fm-parsing:
dataSource:
authType: OAUTH2_SHAREPOINT_APP_ONLY_CLIENT_CREDENTIALS
credentialsSecretArn: 'arn:{{partition}}:secretsmanager:{{region}}:{{account}}:secret:/test/sharepoint/secret-qeTtB0'
domain: mycompany.sharepoint.com
hostType: ONLINE
siteUrls:
- 'https://mycompany.sharepoint.com/sites/mysite'
tenantId: '2b5901be-9f28-4fa4-b565-706cbbc699c5'
vectorIngestionConfiguration:
parsingConfiguration:
parsingStrategy: 'BEDROCK_FOUNDATION_MODEL'
bedrockFoundationModelConfiguration:
modelArn: 'anthropic.claude-3-sonnet-20240229-v1:0'
parsingModality: 'MULTIMODAL'
parsingPromptText: 'Extract key information from this document'
test-sharepoint-ds-custom-parsing:
dataSource:
authType: OAUTH2_SHAREPOINT_APP_ONLY_CLIENT_CREDENTIALS
credentialsSecretArn: 'arn:{{partition}}:secretsmanager:{{region}}:{{account}}:secret:/test/sharepoint/secret-qeTtB0'
domain: mycompany.sharepoint.com
hostType: ONLINE
siteUrls:
- 'https://mycompany.sharepoint.com/sites/mysite'
tenantId: '2b5901be-9f28-4fa4-b565-706cbbc699c5'
vectorIngestionConfiguration:
parsingConfiguration:
parsingStrategy: 'BEDROCK_DATA_AUTOMATION'
bedrockDataAutomationConfiguration:
parsingModality: 'MULTIMODAL'
chunkingConfiguration:
chunkingStrategy: 'NONE'
customTransformationConfiguration:
intermediateStorageBucket: 'custom-transform-intermediate-bucket'
intermediateStoragePrefix: 'path/to/data/objects'
transformLambdaArns:
- generated-function:test-custom-transformer
test-knowledge-base2:
embeddingModel: 'amazon.titan-embed-text-v2:0'
vectorStore: test-vector-store2
vectorFieldSize: 1024
role:
id: generated-role-id:kb-execution-role
supplementalBucketName: 'supplemental-image-storage-bucket'
s3DataSources:
# Data source names must be unique across knowledge bases
test-ds-kb2-default-parsing:
bucketName: 'customer-docs-bucket'
prefix: 'support-documents/'
enableSync: true
# (Optional) Guardrail configurations for AI safety, content
# filtering, and responsible AI deployment.
guardrails:
enterprise-guardrail:
# (Optional) Guardrail description
description: 'Enterprise content safety guardrail'
# Content filter configuration across safety categories
contentFilters:
# (Optional) Hate content filter with input/output strength
# (enum: LOW, MEDIUM, HIGH)
hate:
inputStrength: 'MEDIUM'
outputStrength: 'MEDIUM'
# (Optional) Insults content filter
insults:
inputStrength: 'HIGH'
outputStrength: 'HIGH'
# (Optional) Misconduct content filter
misconduct:
inputStrength: 'HIGH'
outputStrength: 'HIGH'
# (Optional) Prompt attack content filter. Evaluated on inputs only: outputStrength must be NONE
promptAttack:
inputStrength: 'HIGH'
outputStrength: 'NONE'
# (Optional) Sexual content filter
sexual:
inputStrength: 'HIGH'
outputStrength: 'HIGH'
# (Optional) Violence content filter
violence:
inputStrength: 'MEDIUM'
outputStrength: 'MEDIUM'
# (Optional) Custom message when user input is blocked
blockedInputMessaging: 'Your input contains restricted content'
# (Optional) Custom message when model output is blocked
blockedOutputsMessaging: 'Response blocked due to policy restrictions'
# (Optional) Contextual grounding filters for response accuracy
contextualGroundingFilters:
# (Optional) Grounding threshold (0.0-1.0) for source
# material adherence
grounding: 0.95
# (Optional) Relevance threshold (0.0-1.0) for query
# relevance
relevance: 0.90
# (Optional) Sensitive information filters for PII and custom
# regex patterns
sensitiveInformationFilters:
# (Optional) PII entity filter configurations
piiEntities:
# Configure guardrail type when the PII entity is
# detected
- type: EMAIL
# Configure guardrail action when the PII entity is
# detected
action: ANONYMIZE
# (Optional) Specifies the action to take when harmful
# content is detected in the input (BLOCK, ANONYMIZE,
# NONE)
inputAction: ANONYMIZE
# (Optional) Specifies whether to enable guardrail
# evaluation on the input
inputEnabled: true
# (Optional) Specifies the action to take when harmful
# content is detected in the output (BLOCK, ANONYMIZE,
# NONE)
outputAction: ANONYMIZE
# (Optional) Indicates whether guardrail evaluation is
# enabled on the output
outputEnabled: true
- type: PHONE
action: BLOCK
# (Optional) Custom regex pattern filters
regexes:
# The name of the regular expression
- name: 'account-number'
# The regular expression pattern
pattern: '\d{10,12}'
# The guardrail action when matching regex is detected
action: ANONYMIZE
# (Optional) Description of the regular expression
description: 'Matches account numbers'
# (Optional) Specifies the action to take when harmful
# content is detected in the input (BLOCK, NONE)
inputAction: BLOCK
# (Optional) Specifies whether to enable guardrail
# evaluation on the input
inputEnabled: true
# (Optional) Specifies the action to take when harmful
# content is detected in the output (BLOCK, NONE)
outputAction: BLOCK
# (Optional) Specifies whether to enable guardrail
# evaluation on the output
outputEnabled: true
# (Optional) Intervention alarms on this guardrail, across all
# its versions. Notifies the target set in guardrailAlarms below.
interventionAlarm:
# (Optional) Alarm when interventions in one period exceed this count
countThreshold: 25
# (Optional) Alarm when more than this percentage of guardrail
# evaluations in one period intervened
ratePercentThreshold: 15
# (Optional) Notification target and timing for the guardrail
# intervention alarms. Required when a guardrail sets
# interventionAlarm.
guardrailAlarms:
# Create a topic encrypted with the module KMS key. Alternatively,
# set notificationTopicArn to an existing security team topic.
createNotificationTopic: true
# (Optional) Email addresses subscribed to the created topic. Each
# must confirm the SNS subscription before delivery begins.
notificationEmails:
- 'security-team@example.com'
# (Optional) Alarm period in seconds; a multiple of 60, and
# periodSeconds x evaluationPeriods must not exceed 3 hours.
# (default: 300)
periodSeconds: 300
# (Optional) Number of periods compared to the threshold.
# (default: 1)
evaluationPeriods: 3
# (Optional) Breaching periods within evaluationPeriods required
# to alarm. (default: evaluationPeriods)
datapointsToAlarm: 2
# (Optional) AgentCore Gateway target definitions (MCP tool
# sources), keyed by target name. A gateway attaches a target by
# naming it in its `targets` list; each target may be referenced by
# at most one gateway.
gatewayTargets:
support-tools:
# (Optional) Target description (1-200 chars)
description: 'Order support tools backed by a Lambda function'
targetConfiguration:
# Lambda tool source. `generated-function:<name>` references a
# function from lambdaFunctions above; a plain Lambda ARN also
# works (see sample-config-gateway-iam.yaml).
lambda:
lambdaArn: generated-function:test-function
# Tool schema advertised to gateway clients. An inline
# payload here; an S3 document is the alternative.
toolSchema:
inlinePayload:
- name: getOrderStatus
description: 'Returns the current status of a customer order'
inputSchema:
type: object
description: 'Order status request'
properties:
orderId:
type: string
description: 'The order identifier'
filters:
type: object
description: 'Optional result filters'
properties:
includeHistory:
type: boolean
description: 'Include the status history'
required:
- orderId
outputSchema:
type: object
description: 'Order status response'
properties:
status:
type: string
description: 'Current order status'
events:
type: array
description: 'Status history, newest first'
items:
type: string
required:
- status
# (Optional) Outbound credential provider. GATEWAY_IAM_ROLE (the
# default) invokes the tool with the gateway's execution role.
credentialProvider:
type: GATEWAY_IAM_ROLE
support-kb:
description: 'Customer support knowledge base'
targetConfiguration:
# (Optional) Knowledge base tool source: generates a Lambda
# connector that serves one Retrieve tool.
knowledgeBase:
# Knowledge base from the knowledgeBases map above
id: 'config:test-knowledge-base'
# Tool description the model sees
description: 'Search customer support and product documentation.'
# (Optional) Results per query, 1-100
numberOfResults: 5
# (Optional) Search type (enum: HYBRID, SEMANTIC)
overrideSearchType: HYBRID
# (Optional) Runs the connector in your subnets, reaching
# Retrieve through the vpcEndpoints set below. The module
# creates the connector's security group.
networkConfiguration:
subnets:
- 'subnet-0123456789abcdef0'
- 'subnet-0123456789abcdef1'
vpcEndpoints: 'agentcore-private'
# (Optional) AgentCore Gateway configurations (MCP servers), keyed by
# gateway name.
gateways:
support-gateway:
# (Optional) Gateway description (1-200 chars)
description: 'Customer support tools and documentation search'
# authorizerConfiguration is omitted, so callers authenticate with
# AWS IAM (SigV4) - the only inbound auth a harness can call. See
# sample-config-gateway-jwt.yaml for CUSTOM_JWT.
#
# (Optional) MCP protocol configuration. searchType SEMANTIC
# enables natural-language tool discovery and cannot be changed
# after creation.
protocolConfiguration:
instructions: 'Use these tools to look up orders and search support documentation.'
searchType: SEMANTIC
supportedVersions:
- '2025-03-26'
# Targets registered on this gateway, by name from gatewayTargets
targets:
- support-tools
- support-kb
# (Optional) Lambda interceptors, at most one REQUEST and one
# RESPONSE. This one comes from the lambdaFunctions pool.
interceptors:
- interceptionPoints:
- REQUEST
lambdaArn: generated-function:test-gateway-interceptor
# (Optional) Audit log delivery is on by default; this sets a
# finite retention instead of the indefinite default.
logDelivery:
logRetentionDays: 365
# (Optional) VPC endpoint sets, keyed by set name, one per VPC. Both
# the harness and the support-kb connector reference this set and
# share its endpoints. Which endpoints exist is derived from them;
# the set only says how each is reached.
vpcEndpoints:
agentcore-private:
# VPC the endpoints are created in
vpcId: 'vpc-0123456789abcdef0'
# ENI placement for created interface endpoints, at most one
# subnet per availability zone
subnetIds:
- 'subnet-0123456789abcdef0'
- 'subnet-0123456789abcdef1'
# (Optional) Route tables receiving the S3 gateway endpoint for
# container image layers. It carries all S3 traffic on these
# tables; see the module README if other workloads share them.
routeTableIds:
- 'rtb-0123456789abcdef0'
# Each endpoint below is optional and has three states: created
# (omitted), brought (securityGroupId), or external.
#
# (Optional) Created, but in one availability zone only
ecrApi:
subnetIds:
- 'subnet-0123456789abcdef0'
# (Optional) Brought: already provisioned by a central networking
# team. Name the endpoint's own security group.
sts:
securityGroupId: 'sg-0fedcba9876543210'
# (Optional) External: reached over NAT or an endpoint this set
# does not manage
logs:
external: true
# bedrockRuntime, ecrDocker, agentCoreGateway and
# bedrockAgentRuntime are omitted, so they are created.
# (Optional) AgentCore Harness configurations - declarative agent
# loops (model + system prompt + tools) - keyed by harness name.
harnesses:
support-harness:
# Foundation model identifier (on-demand id, inference profile id,
# or ARN)
modelId: 'us.anthropic.claude-sonnet-4-5-20250929-v1:0'
# System prompt defining the agent's behavior
systemPrompt: 'You are a customer support assistant. Search the knowledge base and use the order tools before answering.'
# (Optional) Model sampling; every field is independently optional
modelConfig:
temperature: 0.2
topP: 0.9
# Max tokens per model call
maxTokens: 2048
# (Optional) Global generation cap across one invocation
maxTokens: 16384
# (Optional) Max agent-loop iterations per invocation
maxIterations: 10
# (Optional) Max agent-loop duration per invocation, in seconds
timeoutSeconds: 300
# (Optional) Runtime session lifecycle, 60-28800 seconds each
lifecycleConfiguration:
idleRuntimeSessionTimeout: 900
maxLifetime: 3600
# (Optional) Inbound JWT (OIDC) authorization. Omit for AWS IAM
# (SigV4), as in sample-config-minimal.yaml.
authorizerConfiguration:
customJwt:
# Must end with /.well-known/openid-configuration
discoveryUrl: 'https://example.com/.well-known/openid-configuration'
allowedAudience:
- 'support-clients'
allowedClients:
- 'support-app'
# (Optional) Guardrail by `config:<name>` from the guardrails map
# above, which supplies the version. A literal guardrail id needs
# an explicit `version`.
guardrail:
id: 'config:enterprise-guardrail'
# (Optional) Assessment trace (enum: enabled, disabled,
# enabled_full)
trace: 'enabled'
# (Optional) Tools keyed by tool name; each sets exactly one of
# inlineFunction / agentCoreGateway.
tools:
# Executed by the harness invoker, not AWS
escalate_to_human:
inlineFunction:
description: 'Hands the conversation to a human support agent'
inputSchema:
type: object
properties:
reason:
type: string
description: 'Why the customer needs a human agent'
required:
- reason
# Every tool on the gateway above, by `config:<name>`
support_tools:
agentCoreGateway:
gatewayArn: 'config:support-gateway'
# (Optional) Tool allowlist. List every tool above, or the model
# can never select it; `@support_tools` allows every tool on that
# gateway. Built-in shell and file tools stay disallowed.
allowedTools:
- 'escalate_to_human'
- '@support_tools'
# (Optional) Skills baked into the container image, by path
skills:
- path: '/opt/skills/support-playbook'
# (Optional) Pre-built container image from ECR, pinned by digest.
# Omit to use the AWS-managed harness container.
container:
containerUri: '{{account}}.dkr.ecr.{{region}}.amazonaws.com/support-harness@sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'
# Required: subnets and security groups running the harness's
# sessions. MDAA enforces VPC network mode.
networkConfiguration:
securityGroups:
- 'sg-0123456789abcdef0'
subnets:
- 'subnet-0123456789abcdef0'
- 'subnet-0123456789abcdef1'
# (Optional) VPC endpoint set from vpcEndpoints above, for a
# private (no-NAT) outbound path
vpcEndpoints: 'agentcore-private'
# (Optional) Environment variables for the harness runtime
environmentVariables:
LOG_LEVEL: 'INFO'
SUPPORT_QUEUE: 'tier-1'
# (Optional) PII identifiers masked in the harness log groups, on
# top of the built-in set
dataProtection:
additionalIdentifiers:
- 'DriversLicense-US'
- 'PassportNumber-US'
# (Optional) Log retention in days. Omit for indefinite retention.
logRetentionDays: 365
# (Optional) Context truncation (enum: sliding_window,
# summarization, none). Tuning fields apply to their strategy
# only; `messagesCount` is sliding_window-only.
truncation:
strategy: 'summarization'
# Newest turns kept verbatim
preserveRecentMessages: 5
# Ratio of older content to summarize, 0 < r <= 1
summaryRatio: 0.5
summarizationSystemPrompt: 'Summarize the earlier conversation, preserving order identifiers, customer decisions, and any unresolved issues.'
# (Optional) Named invocation endpoint. targetVersion pins callers
# to a released version; omit it to follow every redeploy.
endpoint:
name: 'prod'
description: 'Production endpoint pinned to a released harness version'
targetVersion: '1'
Knowledge Bases Only
Deploys vector stores and knowledge bases with S3 data sources, encrypted with an existing KMS key, without gateways, harnesses, or guardrails. Use this when another module or application consumes the knowledge bases.
# Contents available via above link
# Knowledge-base-only Bedrock Builder configuration: vector stores and knowledge bases, with no
# gateways, harnesses, guardrails or shared Lambda functions, encrypted with an existing KMS key.
# See CONFIGURATION.md for role reference options (name, arn, id).
# Key-admin roles for a module-created KMS key; unused here because kmsKeyArn is set.
dataAdminRoles:
- name: 'Admin'
# (Optional) Existing KMS key for the module's resources. Omit to have the module create one. The
# module cannot change an existing key's policy, so it must already grant use of the key to Bedrock,
# the execution roles, and CloudWatch Logs (logs.<region>.amazonaws.com) for the KB log groups.
kmsKeyArn: 'arn:{{partition}}:kms:{{region}}:{{account}}:key/test-key-id'
# (Optional) Vector stores backing the knowledge bases below, keyed by store name.
vectorStores:
kb-aurora-store:
# (Optional) Aurora Serverless PostgreSQL with pgvector
# (enum: AURORA_SERVERLESS, OPENSEARCH_SERVERLESS)
vectorStoreType: 'AURORA_SERVERLESS'
# VPC the vector store is deployed into.
# Often created by your VPC/networking stack.
# Example SSM: ssm:/path/to/vpc/id
vpcId: test-vpc-id
# Subnets the vector store is deployed into.
# Often created by your VPC/networking stack.
subnetIds:
- 'test-subnet-id1'
- 'test-subnet-id2'
kb-opensearch-store:
# (Optional) OpenSearch Serverless collection; the module creates the collection's VPC endpoint.
# (enum: AURORA_SERVERLESS, OPENSEARCH_SERVERLESS)
vectorStoreType: 'OPENSEARCH_SERVERLESS'
# VPC the collection's VPC endpoint is created in.
# Often created by your VPC/networking stack.
vpcId: test-vpc-id
# Subnets for the collection's VPC endpoint.
# Often created by your VPC/networking stack.
subnetIds:
- 'test-subnet-id1'
- 'test-subnet-id2'
# (Optional) Knowledge bases, keyed by knowledge base name.
knowledgeBases:
kb-product-docs:
# Embedding model used to vectorize ingested documents.
embeddingModel: 'amazon.titan-embed-text-v2:0'
# Vector store (from vectorStores above) holding this knowledge base's embeddings.
vectorStore: kb-aurora-store
# Execution role the knowledge base and its sync Lambdas run as.
role:
id: generated-role-id:kb-execution-role
# (Optional) S3 data sources, keyed by data source name.
s3DataSources:
product-docs:
# Bucket holding the source documents.
# Often created by your data lake module.
bucketName: 'product-docs-bucket'
# (Optional) Key prefix scoping ingestion within the bucket.
prefix: 'docs/'
# (Optional) Re-ingest automatically when objects under the prefix change. (default: false)
enableSync: true
product-faqs:
bucketName: 'product-docs-bucket'
prefix: 'faqs/'
enableSync: true
# (Optional) Batch sync events through a queue instead of syncing per object. (default: false)
enableMultiSync: true
kb-support-runbooks:
embeddingModel: 'amazon.titan-embed-text-v2:0'
vectorStore: kb-opensearch-store
role:
id: generated-role-id:kb-execution-role
s3DataSources:
runbooks:
bucketName: 'support-runbooks-bucket'
prefix: 'runbooks/'
Knowledge Bases through an AgentCore Gateway
Deploys a knowledge base, an AgentCore Gateway with three knowledgeBase targets (referencing this module's knowledge base, another module's by ssm:, and an existing one by id; the last two run in your VPC through VPC endpoint sets), and a harness that searches them through the gateway. Use this to give a harness, or any gateway client, retrieval over knowledge bases built by this or another module. See Knowledge bases through a gateway.
# Contents available via above link
# Bedrock Builder configuration exposing knowledge bases to an AgentCore Harness through an AgentCore
# Gateway. Each `knowledgeBase` gateway target generates a Lambda connector that calls Retrieve on one
# knowledge base, registered as a Lambda target exposing a single `Retrieve` tool. The model sees each
# tool as `<target name>___Retrieve`, where the prefix is the deployed (MDAA-named) target name.
#
# This config shows the three ways to reference a knowledge base: `config:<name>` for one built by this
# module, an `ssm:` reference for one built by another module, and the id of an existing one, all in the
# same account and region.
# See CONFIGURATION.md for role reference options (name, arn, id).
# Admin roles granted key-admin rights on the module's KMS key.
dataAdminRoles:
- name: 'Admin'
# (Optional) Vector store backing the knowledge base below.
vectorStores:
support-vector-store:
# (Optional) Aurora Serverless PostgreSQL with pgvector
# (enum: AURORA_SERVERLESS, OPENSEARCH_SERVERLESS)
vectorStoreType: 'AURORA_SERVERLESS'
# VPC the vector store is deployed into.
# Often created by your VPC/networking stack.
# Example SSM: ssm:/path/to/vpc/id
vpcId: test-vpc-id
# Subnets the vector store is deployed into.
# Often created by your VPC/networking stack.
subnetIds:
- 'test-subnet-id1'
- 'test-subnet-id2'
# (Optional) Knowledge base built by this module, referenced by the support-kb target below.
knowledgeBases:
kb-test-customer-support:
# Embedding model used to vectorize ingested documents.
embeddingModel: 'amazon.titan-embed-text-v2:0'
# Vector store (from vectorStores above) holding the embeddings.
vectorStore: support-vector-store
# Execution role the knowledge base and its sync Lambdas run as. The connector gets its own role.
role:
id: generated-role-id:kb-execution-role
# (Optional) S3 data sources, keyed by data source name.
s3DataSources:
support-docs:
# Bucket holding the source documents.
# Often created by your data lake module.
bucketName: 'customer-docs-bucket'
# (Optional) Key prefix scoping ingestion within the bucket.
prefix: 'support-documents/'
# (Optional) Gateway targets, keyed by target name.
gatewayTargets:
support-kb:
# (Optional) Target description (1-200 chars). The tool description the model sees is
# knowledgeBase.description below.
description: 'Customer support knowledge base'
targetConfiguration:
# (Optional) Knowledge base tool source: generates a Lambda connector serving one Retrieve tool.
knowledgeBase:
# Knowledge base from the knowledgeBases map above.
id: 'config:kb-test-customer-support'
# Tool description the model sees: what the knowledge base holds and when to search it.
description: 'Search customer support and product documentation.'
# (Optional) Results per query, 1-100. Omit for the service default.
numberOfResults: 5
# (Optional) Search type. Omit to let the knowledge base choose. (enum: HYBRID, SEMANTIC)
overrideSearchType: HYBRID
runbooks-kb:
targetConfiguration:
# (Optional) Knowledge base tool source.
knowledgeBase:
# Knowledge base built by another module, by the id it publishes to SSM.
# Often created by another bedrock-builder module.
id: 'ssm:/{{org}}/{{domain}}/shared-kb/knowledgebase/kb-runbooks/id'
# Tool description the model sees.
description: 'Search operational runbooks for troubleshooting steps.'
# (Optional) Search type. (enum: HYBRID, SEMANTIC)
overrideSearchType: SEMANTIC
# (Optional) Runs this target's connector in your subnets, reaching Retrieve through the
# vpcEndpoints set below. Omit to run it outside your VPC.
networkConfiguration:
# Often created by your VPC/networking stack.
subnets:
- 'test-subnet-id1'
- 'test-subnet-id2'
# Set from vpcEndpoints below. The module creates the connector's security group.
vpcEndpoints: 'kb-private'
policies-kb:
targetConfiguration:
# (Optional) Knowledge base tool source.
knowledgeBase:
# Id of an existing knowledge base (10 alphanumeric characters).
id: 'KBPOLICY01'
# Tool description the model sees.
description: 'Search internal policies and compliance guidelines.'
# (Optional) Runs this target's connector in your subnets. Omit to run it outside your VPC.
networkConfiguration:
# Often created by your VPC/networking stack.
subnets:
- 'test-subnet-id3'
# Set from vpcEndpoints below, which leaves Retrieve to your network.
vpcEndpoints: 'kb-network-managed'
# (Optional) Required because that set marks bedrockAgentRuntime external: a security group
# allowing HTTPS to wherever Retrieve is reached.
# Often created by your VPC/networking stack.
securityGroupId: 'sg-0123456789abcdef1'
# (Optional) VPC endpoint sets, keyed by set name, one per VPC. kb-private gives the runbooks-kb
# connector a private path to Retrieve; kb-network-managed leaves the policies-kb connector's path to
# your network.
vpcEndpoints:
kb-private:
# VPC the endpoints are created in, and the connectors referencing this set run in.
# Often created by your VPC/networking stack.
vpcId: test-vpc-id
# Subnets for the endpoint network interfaces, at most one per availability zone.
subnetIds:
- 'test-subnet-id1'
- 'test-subnet-id2'
# bedrockAgentRuntime is omitted, so its endpoint is created. Set it to wire to an existing endpoint
# (securityGroupId), or to leave Retrieve to your network (external: true).
kb-network-managed:
# Often created by your VPC/networking stack.
vpcId: test-vpc-id-2
# Subnets for any endpoint the set creates; it creates none here.
# Often created by your VPC/networking stack.
subnetIds:
- 'test-subnet-id3'
# (Optional) How the Bedrock Agent Runtime endpoint is reached.
bedrockAgentRuntime:
# (Optional) Retrieve is reached over NAT or an endpoint your network team manages, so nothing is
# created or wired here.
external: true
# (Optional) Gateway fronting the knowledge base targets. Omitting authorizerConfiguration uses AWS IAM
# (SigV4) inbound auth.
gateways:
kb-gateway:
# (Optional) Gateway description (1-200 chars).
description: 'Knowledge base tools for the support harness'
# (Optional) Targets registered against this gateway, by name from gatewayTargets above.
targets:
- support-kb
- runbooks-kb
- policies-kb
# (Optional) Harness that answers from the knowledge bases through the gateway.
harnesses:
support-harness:
# Foundation model identifier for the agent loop.
modelId: 'anthropic.claude-3-sonnet-20240229-v1:0'
# System prompt defining the agent's behavior.
systemPrompt: 'You are a customer support assistant. Search the knowledge bases before answering.'
# (Optional) Tools, keyed by tool name. This one reaches every tool on the gateway above.
tools:
kb_tools:
agentCoreGateway:
gatewayArn: 'config:kb-gateway'
# (Optional) Tool allowlist. `@kb_tools` allows every tool the kb_tools gateway exposes.
allowedTools:
- '@kb_tools'
# Security groups and subnets running the harness's runtime sessions.
# Often created by your VPC/networking stack.
networkConfiguration:
securityGroups:
- 'sg-0123456789abcdef0'
subnets:
- 'subnet-0123456789abcdef0'
AgentCore Gateway Options (AWS IAM)
Deploys an AWS IAM gateway with the options the comprehensive configuration does not use: DEBUG exception detail, non-semantic tool search, a Lambda target by plain ARN with an S3 tool schema, an inline REQUEST interceptor with header pass-through, a RESPONSE interceptor by ARN, and an existing execution role.
sample-config-gateway-iam.yaml
# Contents available via above link
# Bedrock Builder module configuration exercising the AgentCore Gateway option combinations that
# differ from the gateway in sample-config-comprehensive.yaml (CUSTOM_JWT inbound auth is in
# sample-config-gateway-jwt.yaml). Everything here is deployable (successful synth); error-only
# branches (NONE / AUTHENTICATE_ONLY authorizers, not-yet-supported target types and credential
# providers, dangling or shared target references, name collisions) live in the construct unit tests.
#
# What this sample covers that the comprehensive sample does not:
# - gateway exceptionLevel: DEBUG -> verbose exception detail (troubleshooting only)
# - protocolConfiguration.searchType omitted -> semantic search disabled (the service accepts
# only SEMANTIC; omit the field for non-semantic)
# - target lambdaArn as a PLAIN ARN -> (vs generated-function:<name>)
# - target toolSchema via S3 -> (vs an inline payload) with an explicit
# bucketOwnerAccountId (confused-deputy protection)
# - credentialProvider omitted -> defaults to GATEWAY_IAM_ROLE
# - an INLINE lambdaFunction interceptor -> MDAA deploys the interceptor Lambda itself
# - passRequestHeaders: true -> forward inbound headers to the interceptor
# - a RESPONSE interceptor by PLAIN ARN -> both REQUEST and RESPONSE interceptors present
# - gateway role referenced by arn -> (vs an auto-created execution role)
# Admin roles granted key-admin rights on the module's KMS key.
dataAdminRoles:
- name: 'Admin'
# (Optional) AgentCore Gateway target definitions (MCP tool sources), keyed by target name.
gatewayTargets:
claims:
description: 'Claims tool source referenced by a plain Lambda ARN, schema loaded from S3'
targetConfiguration:
lambda:
# Plain Lambda ARN (already-deployed function owned elsewhere) — passed through unchanged
# (no generated-function: resolution). The gateway role is granted scoped invoke on this ARN.
lambdaArn: 'arn:{{partition}}:lambda:{{region}}:{{account}}:function:external-claims-tool'
# S3 tool schema: a JSON tool-schema document maintained as a separate artifact in S3.
# Mutually exclusive with inlinePayload. bucketOwnerAccountId (cross-account confused-deputy
# protection) is set explicitly here; when omitted it defaults to the deploying account
# (see sample-config-gateway-jwt.yaml).
toolSchema:
s3:
uri: 's3://example-tool-schemas/claims/tool-schema.json'
# Explicit 12-digit bucket-owner account (cross-account confused-deputy protection). Set a
# literal account id (not the {{account}} template token) so this validates at synth; when
# omitted MDAA defaults it to the deploying account (see sample-config-gateway-jwt.yaml).
bucketOwnerAccountId: '111122223333'
# credentialProvider omitted -> defaults to GATEWAY_IAM_ROLE.
# (Optional) AgentCore Gateway configurations, keyed by gateway name.
gateways:
claims-gateway:
description: 'Claims MCP gateway (AWS IAM inbound auth)'
# authorizerConfiguration omitted entirely -> AWS_IAM (SigV4). MDAA rejects NONE /
# AUTHENTICATE_ONLY, so omission is how AWS IAM is selected.
#
# exceptionLevel DEBUG raises the verbosity of exception detail the gateway surfaces. Enable only
# for troubleshooting; do not leave on in production.
exceptionLevel: DEBUG
protocolConfiguration:
instructions: 'Use the claims tools to service insurance claims.'
# searchType omitted -> semantic tool discovery disabled. The AgentCore API accepts only
# SEMANTIC (there is no NONE value); omitting the field is how you get a non-semantic gateway.
# Reference an existing IAM role for the gateway execution role (by arn; name or id also work).
# MDAA attaches the gateway's required permissions (KMS use, interceptor invoke) to this role.
role:
arn: 'arn:{{partition}}:iam::{{account}}:role/claims-gateway-execution-role'
targets:
- claims
# Both interception points, each supplied a different way:
interceptors:
# REQUEST: an INLINE Lambda function definition. MDAA deploys this function (encrypted with the
# gateway CMK) and wires the gateway to its ARN. passRequestHeaders forwards inbound headers.
- interceptionPoints:
- REQUEST
passRequestHeaders: true
lambdaFunction:
functionName: claims-request-interceptor
description: 'Inline gateway REQUEST interceptor Lambda'
srcDir: ./src/function
handler: test.lambda_handler
runtime: python3.14
roleArn: 'arn:{{partition}}:iam::{{account}}:role/test-interceptor-role'
# RESPONSE: an already-deployed function referenced by PLAIN ARN (MDAA deploys nothing; it wires
# the gateway to this ARN and grants the execution role scoped invoke on it).
- interceptionPoints:
- RESPONSE
lambdaArn: 'arn:{{partition}}:lambda:{{region}}:{{account}}:function:external-response-interceptor'
# Finite audit-log retention (90 days) instead of the indefinite default.
logDelivery:
logRetentionDays: 90
AgentCore Gateways with JWT Auth
Deploys two gateways with CUSTOM_JWT (OIDC) inbound auth, for MCP clients that present a token rather than AWS credentials, and shows audit log retention and opting out of log delivery. A harness cannot call a JWT gateway, since it authenticates with AWS IAM.
sample-config-gateway-jwt.yaml
# Contents available via above link
# Bedrock Builder module configuration exercising AgentCore Gateways with CUSTOM_JWT (OIDC) inbound
# auth, for MCP clients that present a token rather than AWS credentials, plus the audit
# log-delivery branches. A harness cannot call a JWT gateway (it signs with AWS IAM), so these
# gateways serve external clients. Two gateways are declared so the mutually-exclusive logDelivery
# options each get their own gateway (a single gateway can set only one). Everything here is
# deployable (successful synth).
#
# What this sample covers:
# - gateway A: CUSTOM_JWT with allowedAudience and allowedClients, and a finite
# logDelivery.logRetentionDays
# - gateway B: CUSTOM_JWT with only discoveryUrl, and logDelivery.enabled: false -> opt out of the
# vended log-delivery pipeline (no destination log group / delivery created)
# - an S3 tool schema WITHOUT bucketOwnerAccountId -> defaults to the deploying account
# (confused-deputy protection default branch)
#
# See sample-config-comprehensive.yaml for an AWS_IAM gateway serving a harness, and
# sample-config-gateway-iam.yaml for the remaining gateway options.
# Admin roles granted key-admin rights on the module's KMS key.
dataAdminRoles:
- name: 'Admin'
lambdaFunctions:
functions:
# Tool Lambda fronted by gateway A's target (referenced via generated-function:<name>).
- functionName: metrics-tool
description: 'MCP tool Lambda fronted by the retention gateway'
srcDir: ./src/function
handler: test.lambda_handler
runtime: python3.14
roleArn: 'arn:{{partition}}:iam::{{account}}:role/test-lambda-role'
# Targets are single-use (each referenced by at most one gateway), so declare one per gateway.
gatewayTargets:
# Target for gateway A: inline tool schema, generated-function Lambda ref.
metrics:
description: 'Metrics tool source (inline schema)'
targetConfiguration:
lambda:
lambdaArn: generated-function:metrics-tool
toolSchema:
inlinePayload:
- name: getMetric
description: 'Returns a named metric value'
inputSchema:
type: object
properties:
metric:
type: string
required:
- metric
# Target for gateway B: S3 tool schema WITHOUT bucketOwnerAccountId. MDAA defaults the
# bucket-owner account to the deploying account so the cross-account read is still owner-verified.
reports:
description: 'Reports tool source (S3 schema, defaulted bucket owner)'
targetConfiguration:
lambda:
lambdaArn: 'arn:{{partition}}:lambda:{{region}}:{{account}}:function:external-reports-tool'
toolSchema:
s3:
uri: 's3://example-tool-schemas/reports/tool-schema.json'
# bucketOwnerAccountId omitted -> defaults to the deploying account.
gateways:
# Gateway A: full CUSTOM_JWT and finite audit-log retention.
metrics-gateway:
description: 'Metrics MCP gateway with finite log retention'
# Inbound authorization. MDAA rejects NONE / AUTHENTICATE_ONLY (compliance).
authorizerConfiguration:
customJwt:
# OIDC discovery URL; must end with /.well-known/openid-configuration.
discoveryUrl: 'https://example.com/.well-known/openid-configuration'
# (Optional) Allowed audiences validated against the token `aud` claim.
allowedAudience:
- 'metrics-clients'
- 'metrics-admin'
# (Optional) Allowed client IDs validated against the token `client_id` claim.
allowedClients:
- 'client-abc123'
targets:
- metrics
logDelivery:
# A valid CloudWatch Logs RetentionDays value (validated at synth). 30 days here.
logRetentionDays: 30
# Gateway B: opt out of vended log delivery entirely (no log group / source / destination /
# delivery are provisioned). Not recommended — audit logs are then not captured — but supported.
reports-gateway:
description: 'Reports MCP gateway with log delivery disabled'
authorizerConfiguration:
customJwt:
# Minimal CUSTOM_JWT: only the required discoveryUrl (no allowedAudience / allowedClients).
discoveryUrl: 'https://example.com/.well-known/openid-configuration'
targets:
- reports
logDelivery:
enabled: false
Guardrail Alarms with an Existing Notification Topic
Deploys a guardrail whose intervention alarms notify an existing SNS topic through guardrailAlarms.notificationTopicArn, instead of a topic the module creates. Use this when you already manage a central security or incident topic. It has its own sample because notificationTopicArn and createNotificationTopic (used in the comprehensive configuration) are mutually exclusive. See Guardrail intervention alarms.
sample-config-guardrail-alarms-existing-topic.yaml
# Contents available via above link
# Bedrock Builder guardrail with intervention alarms notifying an EXISTING SNS topic.
# Demonstrates guardrailAlarms.notificationTopicArn; the comprehensive config shows
# guardrailAlarms.createNotificationTopic instead.
# See CONFIGURATION.md for role reference options (name, arn, id). Admin roles are granted
# key-admin rights on the module's KMS key.
dataAdminRoles:
- name: 'Admin'
# Guardrail configurations, keyed by guardrail name.
guardrails:
security-guardrail:
# Content filter configuration across safety categories
contentFilters:
# Prompt attack content filter. Evaluated on inputs only: outputStrength must be NONE
promptAttack:
inputStrength: 'HIGH'
outputStrength: 'NONE'
# Intervention alarms on this guardrail, across all its versions
interventionAlarm:
# Alarm when interventions in one period exceed this count
countThreshold: 25
# Notification target for the guardrail intervention alarms.
guardrailAlarms:
# Notify an existing SNS topic instead of creating one
notificationTopicArn: 'arn:{{partition}}:sns:{{region}}:{{account}}:security-alerts'
# (Optional) Alarm period in seconds; a multiple of 60. (default: 300)
periodSeconds: 600