Closed santoshsg1308 closed 6 months ago
Hi @santoshsg1308, I am sorry for the late reply. Please refer to the generative-ai-cdk-constructs repo for the latest constructs. I don't have currently time to maintain my construct and will focus my attention on contributing to the mentioned repo as it is maintained by AWS team.
Thanks!
Hi I am trying to create a knowledgebase using the construct but keep getting the error below
"Received response status [FAILED] from custom resource. Message returned: Error: An error occurred (ValidationException) when calling the CreateKnowledgeBase operation: The knowledge base storage configuration provided is invalid... Bad Authorization"
Below is my code
` // Create managed policies for the role const s3ListBucketStatement = new iam.PolicyStatement({ actions: ["s3:ListBucket"], resources: ["arn:aws:s3:::bucketName"], }); const s3GetObjectStatement = new iam.PolicyStatement({ actions: ["s3:GetObject"], resources: ["arn:aws:s3:::bucketName/*"], }); const s3ManagedPolicy = new iam.ManagedPolicy( this, "AmazonBedrockS3PolicyForKnowledgeBase_test", { managedPolicyName: "AmazonBedrockS3PolicyForKnowledgeBase_test", statements: [s3ListBucketStatement, s3GetObjectStatement], } );
There is something to do with role here I believe because if I replace rolearn with role that was automatically created during creation of another knowledgebase through console then the knowledgebase creation goes through successfully. As you see I have tried to attach the policies required for the role to mimic to the automatically created role. Also tried attaching the AdministratorAccess policy to the role but no luck !
Below are the error details from cloudformation I see
Received response status [FAILED] from custom resource. Message returned: Error: An error occurred (ValidationException) when calling the CreateKnowledgeBase operation: The knowledge base storage configuration provided is invalid... Bad Authorization Logs: /aws/lambda/IngestionStack-dev1-BedrockAgentCus-PXN9dyVk0gcz at invokeUserFunction (/var/task/framework.js:2:6) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async onEvent (/var/task/framework.js:1:369) at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: ec2bc795-366c-45d0-8064-7b991920d1a3)
Can you please help?