Skip to content

Commit 70d3e14

Browse files
committed
fix: Gateway target expects an AgentCore API key credential provider ARN, not a Secrets Manager secret ARN
1 parent 11b2ae5 commit 70d3e14

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

DEVELOP.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,17 @@ cdk deploy --app 'node lib/dictionary-mcp-server.js'
211211

212212
Deploy the 'zen' Bedrock AgentCore Gateway.
213213

214+
First, create a Bedrock AgentCore API key credential provider:
215+
216+
```bash
217+
aws bedrock-agentcore-control create-api-key-credential-provider \
218+
--name zen-quotes-api-key \
219+
--api-key "dummy-key" \
220+
--region us-west-2
221+
```
222+
223+
Then deploy the gateway:
224+
214225
```bash
215226
cd examples/servers/zen/
216227

examples/servers/zen/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ specification for the [ZenQuotes](https://zenquotes.io/) API.
99
- Authentication: OAuth
1010
- Endpoint: Bedrock AgentCore Gateway
1111

12+
### Prerequisites
13+
14+
Before deploying, you need to create a Bedrock AgentCore API key credential provider:
15+
16+
```bash
17+
aws bedrock-agentcore-control create-api-key-credential-provider \
18+
--name zen-quotes-api-key \
19+
--api-key "dummy-key" \
20+
--region us-west-2
21+
```
22+
1223
### Deploy
1324

1425
```bash

examples/servers/zen/cdk_stack.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
CfnOutput,
55
Environment,
66
Fn,
7-
SecretValue,
87
Stack,
98
aws_bedrockagentcore as bedrockagentcore,
10-
aws_secretsmanager as secretsmanager,
119
)
1210
from cdk_nag import AwsSolutionsChecks, NagSuppressions
1311
from constructs import Construct
@@ -54,18 +52,6 @@ def __init__(
5452
exception_level="DEBUG",
5553
)
5654

57-
# Create secret for API key
58-
api_key_secret = secretsmanager.Secret(
59-
self,
60-
"ZenQuotesApiKey",
61-
secret_string_value=SecretValue.unsafe_plain_text("hello world")
62-
)
63-
64-
NagSuppressions.add_resource_suppressions(
65-
api_key_secret,
66-
[{"id": "AwsSolutions-SMG4", "reason": "Placeholder API key for demo purposes"}]
67-
)
68-
6955
bedrockagentcore.CfnGatewayTarget(
7056
self,
7157
"GatewayTarget",
@@ -83,7 +69,7 @@ def __init__(
8369
"credentialProviderType": "API_KEY",
8470
"credentialProvider": {
8571
"apiKeyCredentialProvider": {
86-
"providerArn": api_key_secret.secret_arn,
72+
"providerArn": f"arn:aws:bedrock-agentcore:{self.region}:{self.account}:token-vault/default/apikeycredentialprovider/zen-quotes-api-key",
8773
"credentialLocation": "HEADER",
8874
"credentialParameterName": "X-Ignore-This"
8975
}

0 commit comments

Comments
 (0)