@@ -2,6 +2,7 @@ import {Construct} from "constructs"
22import { Role } from "aws-cdk-lib/aws-iam"
33import { Bucket } from "aws-cdk-lib/aws-s3"
44import * as bedrock from "aws-cdk-lib/aws-bedrock"
5+ import { createHash } from "crypto"
56
67export interface VectorKnowledgeBaseProps {
78 embeddingsModel : string
@@ -19,7 +20,7 @@ export class VectorKnowledgeBaseResources extends Construct {
1920 super ( scope , id )
2021
2122 this . guardrail = new bedrock . CfnGuardrail ( this , "Guardrail" , {
22- name : `eps-gr- ${ this . node . addr } ` , // eps-assist-guardrail
23+ name : `eps-assist-guardrail- ${ createHash ( "md5" ) . update ( this . node . addr ) . digest ( "hex" ) . substring ( 0 , 8 ) } ` ,
2324 description : "Guardrail for EPS Assist Me Slackbot" ,
2425 blockedInputMessaging : "Your input was blocked." ,
2526 blockedOutputsMessaging : "Your output was blocked." ,
@@ -47,7 +48,7 @@ export class VectorKnowledgeBaseResources extends Construct {
4748 } )
4849
4950 this . knowledgeBase = new bedrock . CfnKnowledgeBase ( this , "VectorKB" , {
50- name : `eps-kb-${ this . node . addr } ` , // eps-assist-kb
51+ name : `eps-assist- kb-${ createHash ( "md5" ) . update ( this . node . addr ) . digest ( "hex" ) . substring ( 0 , 8 ) } ` ,
5152 description : "Knowledge base for EPS Assist Me Slackbot" ,
5253 roleArn : props . bedrockExecutionRole . roleArn ,
5354 knowledgeBaseConfiguration : {
@@ -72,7 +73,7 @@ export class VectorKnowledgeBaseResources extends Construct {
7273
7374 new bedrock . CfnDataSource ( this , "S3DataSource" , {
7475 knowledgeBaseId : this . knowledgeBase . attrKnowledgeBaseId ,
75- name : `eps-ds- ${ this . node . addr } ` , // eps-assist-kb
76+ name : `eps-assist-s3-datasource- ${ createHash ( "md5" ) . update ( this . node . addr ) . digest ( "hex" ) . substring ( 0 , 8 ) } ` ,
7677 dataSourceConfiguration : {
7778 type : "S3" ,
7879 s3Configuration : {
0 commit comments