Set up Redis for Bedrock

Shows how to set up your Redis database for Amazon Bedrock.

You need to set up your Redis Cloud database before you can set it as the vector database in Amazon Bedrock. To do this, you need to:

  1. Sign up for Redis Cloud and create a database
  2. Enable Transport Layer Security (TLS) for the database and save the certificates
  3. Store database credentials in AWS secrets manager
  4. Create a vector index in your database for Bedrock to use

After you set up the database, you can use the database information to set it as your knowledge base database when you create a knowledge base.

Sign up and create a database

To set up a Redis Cloud instance for Bedrock, you need to:

  1. Sign up for Redis Cloud if you do not already have an account.
  2. Create a database to use for your Bedrock knowledge base.

Sign up for Redis Cloud using AWS Marketplace

  1. Select the Redis Cloud AWS marketplace link from Bedrock to be taken to the Redis Cloud plan listing.

    The Redis Cloud listing on AWS Marketplace
  2. Subscribe to Redis Cloud listing, locate the Set Up Your Account button, and then select it to begin mapping your Redis Cloud account with your AWS Marketplace account.

    Use the Set Up Your Account button after subscribing to Redis Cloud with your AWS Marketplace account.
  3. Sign in to the Redis Cloud admin console.

  4. Select the Redis account to be mapped to your AWS Marketplace account and confirm that your payment method will change and that the connection cannot be undone.

    Use the AWS Marketplace dialog to map your Redis Cloud account to your AWS Marketplace account.
  5. Use the Map account button to confirm your choice.

  6. Once your Redis account is mapped to your AWS Marketplace account, a message appears in the upper, left corner of the account panel.

    The AWS Marketplace badge appears when your Redis Cloud account is mapped to an AWS Marketplace account.

    In addition, AWS Marketplace is reported as the selected payment method.

Create a database

  1. In the admin console, select New database.

    The New Database button creates a new database.
  2. When the New database page appears, select Vector search from the use case panel.

    The Redis Use case panel
  3. Select Pro to create a Pro plan.

    The Subscription selection panel with Pro selected.
  4. Select Amazon Web Services as the cloud vendor, select a region, and enter a name for your subscription.

    The General settings of the Setup tab.
  5. In the Version section, select Redis 7.2.

    Version selection between Redis 6.2 and 7.2
  6. In the Advanced options section, select Multi-AZ to ensure high-availability.

    The Multi-AZ toggle set to on.
  7. When finished, select Continue.

    Select the Continue button to continue to the next step.
  8. The Sizing tab helps you specify the database requirements for your subscription.

    The Sizing tab when creating a new Flexible subscription.

    Select the Add button to create a database.

    Use the Add button to define a new database for your subscription.
  9. In the New Database dialog, name your database.

    The New Database dialog with basic settings.

    We selected Search and query and JSON for you already. Search and query enables vector database features for your database. You can remove JSON if you want.

  10. Set the Memory limit of your database based on the amount of data that Bedrock will pull from your Simple Storage Service (S3) bucket. See Find out the size of your S3 buckets to find out how much knowledge base data is stored in your S3 bucket and pick the closest size, rounded up, from the table below.

    Total Size of Documents in S3 Database size without replication Database size with replication
    10,000 kb 135 Mb 270 Mb
    100,000 kb 1.35 Gb 2.7 Gb
    1,000,000 kb 13.5 Gb 27 Gb
    10,000,000 kb 135 Gb 270 Gb

    For more information on sizing, see the Bedrock integration blog post.

  11. When finished, select Save database to create your database.

    Select the Save Database button to define your new database.
  12. Select Continue to move to the Review and Create tab.

  13. Review your subscription. You will not need to enter a payment method, as it's automatically assigned to your AWS Marketplace account.

  14. Select Confirm & pay to create your new database.

    Select Confirm & pay to create your new database.

    Note that databases are created in the background. While they are provisioning, you aren't allowed to make changes. (The process generally takes 10-15 minutes.)

    Use the Databases list to check the status of your subscription. You will also receive an email when your database is ready to use.

Enable TLS and get certificates

For your database to be fully secure, you must enable Transport Layer Security (TLS) for your database with client authentication.

  1. Select Databases from the admin console menu and then select your database from the list.

  2. From the database's Configuration screen, select the Edit database button:

    The Edit database button lets you change selected database properties.
  3. In the Security section, use the Transport layer security (TLS) toggle to enable TLS:

    Use the Transport Layer Security toggle to enable TLS.
  4. Select Download server certificate to download the Redis Cloud certificate bundle redis_ca.pem:

    Use the Download server certificate button to download the Redis Cloud CA certificates.
  5. Select the Mutual TLS (require client authentication) checkbox to require client authentication.

  6. Select Add client certificate to add a certificate.

    The Add client certificate button.
  7. Either provide an X.509 client certificate or chain in PEM format for your client or select Generate to create one:

    Provide or generate a certificate for Mutual TLS.
    • If you generate your certificate from the Redis Cloud console, a Download certificate button will appear after it is generated. Select it to download the certificate.

      The Download certificate button.

      The download contains:

      • redis-db-<database_id>.crt – the certificate's public key.

      • redis-db-<database_id>.key – the certificate's private key.

      You must download the certificate using the button at this point. After your changes have been applied, the full bundle of public and private keys will no longer be available for download.
    • If you provide a client certificate, you will see the certificate details before you save your changes.

      The Download certificate button.
  8. To apply your changes and enable TLS, select the Save database button:

    Use the Save database button to save database changes.

Store database credentials in AWS secrets manager

In the AWS Management Console, use the Services menu to locate and select Security, Identity, and Compliance > Secrets Manager. Create a secret of type Other type of secret with the following key/value fields:

  • username: Database username
  • password: Database password
  • serverCertificate: Contents of the server certificate (redis_ca.pem)
  • clientCertificate: Contents of the client certificate (redis_user.crt)
  • clientPrivateKey: Contents of the client private key (redis_user_private.key)

After you store this secret, you can view and copy the Amazon Resource Name (ARN) of your secret on the secret details page.

Create a vector index in your database

After your Redis Cloud database is set up, create a search index with a vector field using FT.CREATE as your knowledge base for Amazon Bedrock. You can accomplish this using Redis Insight or redis-cli.

Redis Insight

Redis Insight is a free Redis GUI that allows you to visualize and optimize your data in Redis.

To create your vector index in Redis Insight:

  1. Download and install Redis Insight if you don't have it already.

  2. In the Redis Cloud admin console, in your database's Configuration tab, select the Connect button next to your database to open the connection wizard.

    Connect button.
  3. In the connection wizard, under Redis Insight Desktop, select Public Endpoint. Select Open with Redis Insight to connect to the database with Redis Insight.

  4. Select Use TLS. In the CA Certificate section, select Add new CA certificate. Give the certificate a name in the Name field, and enter the contents of redis_ca.pem into the Certificate field.

    The Redis Insight Add CA Certificate section.
  5. Select Requires TLS Client Authentication. In the Client Certificate section, select Add new certificate. Give the certificate a name in the Name field. Enter the contents of redis_user.crt into the Certificate field, and the contents of redis_user_private.key into the Private Key field.

    The Redis Insight Add Client Certificate section.
  6. Select Add Redis Database to connect to the database.

  7. Select your database alias to connect to your database. Select the Workbench icon to go to the workbench.

    The Redis Insight workbench icon.
  8. Enter the FT.CREATE command to create an index.

    FT.CREATE <index_name>                    
        ON HASH                
            "<text_field>" TEXT
            "<metadata_field>" TEXT                   
            "<vector_field>"  VECTOR FLAT     
                "TYPE" "FLOAT32"            
                "DIM" 1536                   
                "DISTANCE_METRIC" "COSINE"  

    Replace the following fields:

    • <index_name> with the vector index name
    • <text_field> with the text field name
    • <metadata_field> with the metadata field name
    • <vector_field> with the vector field name
  9. Select Run to create the index.

    The Redis Insight run button.


The redis-cli command-line utility lets you connect and run Redis commands directly from the command line. To use redis-cli, you can install Redis.

Public endpoint and port details are available from the Databases list or the database's Configuration screen. Select Connect to view how to connect to your database with redis-cli.

redis-cli -h <endpoint> -p <port> --tls --cacert redis_ca.pem \
    --cert redis_user.crt --key redis_user_private.key

After you are connected with redis-cli, create an index using FT.CREATE.

FT.CREATE <index_name>                    
    ON HASH                
        "<text_field>" TEXT
        "<metadata_field>" TEXT                   
        "<vector_field>"  VECTOR FLAT     
            "TYPE" "FLOAT32"            
            "DIM" 1536                   
            "DISTANCE_METRIC" "COSINE"  

Replace the following fields:

  • <index_name> with the vector index name
  • <text_field> with the text field name
  • <metadata_field> with the metadata field name
  • <vector_field> with the vector field name

Next steps

After your Redis database is set up, you can use it to create a knowledge base in Amazon Bedrock.

Back to top ↑