Skip to content

Commit 4502cc1

Browse files
committed
Update Bedrock prompt policy to use specific prompt name instead
1 parent 6e8a32e commit 4502cc1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/cdk/resources/RuntimePolicies.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface RuntimePoliciesProps {
1616
readonly knowledgeBaseArn: string
1717
readonly guardrailArn: string
1818
readonly dataSourceArn: string
19+
readonly promptName: string
1920
}
2021

2122
export class RuntimePolicies extends Construct {
@@ -63,7 +64,10 @@ export class RuntimePolicies extends Construct {
6364

6465
const slackBotPromptPolicy = new PolicyStatement({
6566
actions: ["bedrock:GetPrompt"],
66-
resources: [`arn:aws:bedrock:${props.region}:${props.account}:prompt/*`]
67+
resources: [
68+
`arn:aws:bedrock:${props.region}:${props.account}:prompt/${props.promptName}`,
69+
`arn:aws:bedrock:${props.region}:${props.account}:prompt/${props.promptName}:*`
70+
]
6771
})
6872

6973
const slackBotKnowledgeBasePolicy = new PolicyStatement({

packages/cdk/stacks/EpsAssistMeStack.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class EpsAssistMeStack extends Stack {
9494
account
9595
})
9696

97-
// Create runtime policies that depend on VectorKB ARNs
97+
// Create runtime policies with resource dependencies
9898
const runtimePolicies = new RuntimePolicies(this, "RuntimePolicies", {
9999
region,
100100
account,
@@ -104,7 +104,8 @@ export class EpsAssistMeStack extends Stack {
104104
slackBotStateTableKmsKeyArn: tables.slackBotStateTable.kmsKey.keyArn,
105105
knowledgeBaseArn: vectorKB.knowledgeBase.attrKnowledgeBaseArn,
106106
guardrailArn: vectorKB.guardrail.attrGuardrailArn,
107-
dataSourceArn: vectorKB.dataSourceArn
107+
dataSourceArn: vectorKB.dataSourceArn,
108+
promptName: bedrockPrompts.queryReformulationPrompt.promptName
108109
})
109110

110111
// Create Functions construct with actual values from VectorKB

0 commit comments

Comments
 (0)