To use the Create Amazon Bedrock Knowledge Base and Data Source using Guide recipe, the following prerequisites must be met:
•Create an index in Pinecone
•Configure AWS Secrets Manager
•Configure Amazon S3 bucket
•Configure Role and Policy
Creating an index in Pinecone
To use the index in Amazon Bedrock, you must create an index in Pinecone and add text for the context.
1Open the Create a new index page in Pinecone.
2In the Default field, enter an index name and the dimensions as shown in the following image:
Note: For the titan-embed-text-v2 model, the available dimensions are 256, 512, 1024. For the titan-embed-text-v1 model, the dimension is 1536. For the cohere models, dimension is 1024. The Create Amazon Bedrock Knowledge Base and Data Source using Guide recipe is preconfigured with model titan-embed-text-v1.
3Click Create index.
You can save the index host value and API key for future use.
After creating the index, you can use the HOST value with https:// in the Index_Host input parameter as shown in the following image:
Configuring AWS Secrets Manager
Configure the AWS secret manager and the secret ARN.
1Open the AWS console.
2Go to the AWS Secrets Manager service and click Store a new secret as shown in the following image:
3In the Choose secret type page, select the Other type of secret in the Secret type section, and set the key as apiKey and enter the Pinecone API key value that you created previously, and then click Next as shown in the following image:
4In the Configure secret page, set the secret manager name and click Next as shown in the following image:
5Go to the secret manager that you created and save the Secret ARN as shown in the following image for future use:
Configure Amazon S3 bucket
To configure an Amazon S3 bucket, perform the following steps:
1Go to Amazon S3 > Buckets, and then click Create bucket as shown in the following image:
2Select the bucket type as General purpose and enter the S3 bucket name in the Bucket name field as shown in the following image:
The bucket name will be used as a BucketName variable.
Configure Role and Policy
Configure role and policy in AWS Identity and Access Management (IAM).
1Go to Amazon Identity and Access Management (IAM) > Policies > Create policy and create a new policy as shown in the following image:
3Go to Amazon Identity and Access Management (IAM) > Roles > Create role and create a new role as shown in the following image:
4In the Select trusted entity page, select Custom trust policy in the Trusted entity type section, and configure the policy as shown in th efollowing example:
Here is the sample to configure trust policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AmazonBedrockKnowledgeBaseTrustPolicy",
"Effect": "Allow",
"Principal": {
"Service": "bedrock.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
5In the Add permissions page, add the created policy and set the role name, and then click Next as shown in the following image:
6Go to the created role and save the role ARN for future use as shown in the following image:b