# Amazon Bedrock

## Overview

Amazon Bedrock integration in LLM Labs lets you connect your own models to Datasaur, making them available for evaluation and deployment within LLM Labs. It enhances security compliance by giving you complete control and privacy over your data. By using your own LLMs, you can ensure that sensitive information remains within your organization's ecosystem.

## Setup

### Connect to Amazon SageMaker Jumpstart <a href="#connect-to-amazon-sagemaker-jumpstart" id="connect-to-amazon-sagemaker-jumpstart"></a>

1. Select **Amazon Bedrock.**

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-cadc239a2dba3daaf8ec7df6be5af622d2a38531%2FModels%20-%20Manage%20providers%20dialog%20-%20initial.png?alt=media" alt=""><figcaption></figcaption></figure>
2. Enter your external ID, Role ARN, and Region.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-647a2d6698886e97e963abc8584e3ca02bff70b8%2FModels%20-%20Manage%20providers%20dialog%20-%20Bedrock%20-%20Initial.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
[Learn more on how to create a role ARN.](https://docs.datasaur.ai/llm-projects/models/amazon-bedrock#create-a-role-arn-for-amazon-bedrock)
{% endhint %}

4. Once you have connected Amazon Bedrock to LLM Labs, you will see a list of available LLMs that you have already deployed. You can immediately use these models within LLM Labs.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-71367b1fc62e220a690379cb31ba1aab577d3912%2FModels%20-%20Manage%20providers%20dialog%20-%20Bedrock%20-%20models%20retrieved.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Every new model that you deploy in Amazon Bedrock will be synced to Datasaur, and you can use it right away in Datasaur. If the models you just deployed haven't appeared on Datasaur, you can click **Sync models**.
{% endhint %}

### **Create a Role ARN for Amazon Bedrock**

1. Open the IAM console at <https://console.aws.amazon.com/iam/>.
2. Choose **Roles** and then choose **Create role**.
3. Choose **Custom trust policy** in the trusted entity type section.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-7119d88df9f7ab90dd3b70bc2cb9334fdfbb1c95%2FModels%20-%20Manage%20providers%20dialog%20-%20Bedrock%20-%20select%20trusted%20entity.png?alt=media" alt=""><figcaption></figcaption></figure>
4. Paste the following configurations in custom trust policy. Don't forget to replace the **ExternalID**. After that, click **Next**.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "682361690817"
            },
            "Action": "sts:AssumeRole",
            "Condition": {
                "StringEquals": {
                    "sts:ExternalId": "<externalID>"
                }
            }
        },
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "bedrock.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
```

5. In the Add permissions section, pick the policy **AmazonBedrockFullAccess**. After that, click **Next**.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-c97f8298c7fe0361ebb6cb9964e717f6f2948026%2FModels%20-%20Manage%20providers%20dialog%20-%20Bedrock%20-%20Add%20permissions.png?alt=media" alt=""><figcaption></figcaption></figure>
6. Enter a **Role name** and a **Description** (optional).
7. Choose **Create role**.
8. After that, back to the **Roles** page, and click on your newly created role.
9. Copy the **Role ARN** from the page and paste it in Amazon Bedrock dialog in Datasaur. Then, click **Add Credentials** to connect.

## **Supported Amazon Bedrock models**

Datasaur supports a wide range of models available in Amazon Bedrock. You can find the list of supported models here: [Amazon Bedrock Models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html).

{% hint style="info" %}
Currently, Datasaur only supports text generation Large Language Models.
{% endhint %}

Additionally, you can bring your own **fine-tuned models** from Amazon Bedrock into Datasaur, allowing for greater customization and performance tailored to your specific use cases. [Learn more about fine-tuning](https://docs.datasaur.ai/llm-projects/models/fine-tuning).

## Disconnect Amazon Bedrock

To disconnect Amazon Bedrock from Datasaur, follow these steps:

1. Click **Manage providers**, then click **View details** on Amazon SageMaker JumpStart provider.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-75a83803bf4aab9f984090bf22edf7a4f15d24ae%2FModels%20-%20Manage%20providers%20dialog%20-%20Bedrock%20-%20connected.png?alt=media" alt=""><figcaption></figcaption></figure>
2. In the dialog that opens, click **Disconnect** at the bottom left.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-7ba39fa857031c91e86adef59ce27f6d2b676c7f%2FModels%20-%20Manage%20providers%20dialog%20-%20Bedrock%20-%20provider%20details.png?alt=media" alt=""><figcaption></figcaption></figure>

## Availability

The models will be accessible to all workspace members for use in their projects. Additionally, only the **Admin** can remove the Amazon Bedrock provider from the workspace.
