Skip to content

Commit 1e889b3

Browse files
committed
fix: Add secrets access to Lambda functions
1 parent 50558b4 commit 1e889b3

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

DEVELOP.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and using an example chatbot client to communicate with those Lambda-based MCP s
99
The example chatbot client will communicate with ten servers:
1010

1111
1. **dad-jokes**: Ask "Tell me a good dad joke."
12-
2. **dog-facts**: Ask "Tell me something about dogs."
12+
2. **dog-facts**: Ask "Tell me something about golden retrievers."
1313
3. **book-search**: Ask "Who wrote the book Pride and Prejudice?"
1414
4. **dictionary**: Ask "How do you pronounce the word 'onomatopoeia'?"
1515
5. **zen**: Ask "Tell me the inspirational quote of the day."
@@ -56,6 +56,11 @@ aws iam attach-role-policy \
5656
--role-name mcp-lambda-example-servers \
5757
--policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
5858

59+
aws iam put-role-policy \
60+
--role-name mcp-lambda-example-servers \
61+
--policy-name secret-access \
62+
--policy-document file://examples/servers/lambda-function-role-policy.json
63+
5964
aws iam create-role \
6065
--role-name mcp-lambda-example-agentcore-gateways \
6166
--assume-role-policy-document file://examples/servers/bedrock-agentcore-gateway-assume-role-policy.json

e2e_tests/setup/integ-test-authentication.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ Resources:
175175
Principal:
176176
Service: lambda.amazonaws.com
177177

178+
LambdaSecretsAccessPolicy:
179+
Type: "AWS::IAM::Policy"
180+
Properties:
181+
PolicyName: mcp-lambda-example-servers-secret-access
182+
PolicyDocument:
183+
Version: "2012-10-17"
184+
Statement:
185+
- Effect: Allow
186+
Action:
187+
- "secretsmanager:GetSecretValue"
188+
Resource:
189+
- "*"
190+
Roles:
191+
- !Ref LambdaFunctionsRole
192+
178193
BedrockAgentCoreGatewaysRole:
179194
Type: AWS::IAM::Role
180195
Properties:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Sid": "GetSecretValue",
6+
"Effect": "Allow",
7+
"Action": ["secretsmanager:GetSecretValue"],
8+
"Resource": "*"
9+
}
10+
]
11+
}

pipeline/src/pipeline-stack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export class McpServersPipelineStack extends cdk.Stack {
143143
// Create IAM role if it doesn't exist
144144
`aws iam create-role --role-name mcp-lambda-example-servers --assume-role-policy-document file://examples/servers/lambda-assume-role-policy.json || true`,
145145
`aws iam attach-role-policy --role-name mcp-lambda-example-servers --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole || true`,
146+
`aws iam put-role-policy --role-name mcp-lambda-example-servers --policy-name secret-access --policy-document file://examples/servers/lambda-function-role-policy.json || true`,
146147
"cd examples/servers/auth",
147148
"npm install",
148149
],

0 commit comments

Comments
 (0)