> For the complete documentation index, see [llms.txt](https://docs.datasaur.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datasaur.ai/build-model/datasaur-dinamic/aws-sagemaker.md).

# Datasaur Dinamic with Amazon SageMaker Autopilot

## Introduction

**Datasaur Dinamic** with [Amazon SageMaker](https://aws.amazon.com/sagemaker/train/) lets you build and train models using Datasaur and AWS together. Your labeled data is directly connected to Amazon SageMaker to start the training process.

## Quick start guide

Follow these steps to train a model with **Datasaur Dinamic** and Amazon SageMaker.

### Setup Datasaur Dinamic extension

1. Create a custom row labeling project.
2. If the dataset is unlabeled, start by labeling part of the data first. For example, if the dataset has 20 rows, you can label 10–15 rows and [automate the rest later](#automate-the-rest-of-the-data-with-ml-assisted).
3. Enable the **Datasaur Dinamic** extension from the **Manage extensions** dialog.

   <figure><img src="/files/C3I16RaCCPmGZHyCGRrO" alt=""><figcaption></figcaption></figure>
4. Select the **AWS Sagemaker** provider.

   <figure><img src="/files/lbgBlvcm9agY3jdpXl3q" alt=""><figcaption></figcaption></figure>

### Setup an IAM role in AWS

{% hint style="info" %}
Make sure you have an AWS S3 bucket available for storing training data and model outputs.
{% endhint %}

#### Create IAM Policies

1. Open the **IAM** page and navigate to the **Policies** section.
2. Click **Create policy**.

   <figure><img src="/files/N7QwJRtYvhP5Tdr3rxg2" alt=""><figcaption></figcaption></figure>
3. Create the following policies:
   * `sagemaker-limited-access`
   * `sagemaker-s3-specific-permissions`

Use the provided policy examples and update the variables with your bucket information.

{% file src="/files/l5Ka6FxshtMHLUw0pSlF" %}
sagemaker-limited-access
{% endfile %}

{% file src="/files/zFJXgAXxct7lrTKFXifC" %}
sagemaker-s3-specific-permissions
{% endfile %}

#### Create an IAM role

1. Go to the **IAM** page and navigate to the **Roles** section.
2. Click on **Create role.**
3. Select **AWS account** as the role type and enter the **Account ID** and **External ID** generated in the **Datasaur Dinamic** extension.

   <figure><img src="/files/gpWoPP6RvPYxwzAzQeuq" alt=""><figcaption><p>Select trusted entity</p></figcaption></figure>
4. In the **Add permissions** step, attach the policies created earlier.

   <figure><img src="/files/72YMzkmuoohVVzO3oAnr" alt=""><figcaption><p>Add permissions</p></figcaption></figure>
5. In step 3, complete the role creation process by entering a role name and details.
6. After creating the role, open the role and go to the **Trust relationships** tab.
7. Edit the trust policy and add the following statement:

```
{
    "Effect": "Allow",
    "Principal": {
        "Service": "sagemaker.amazonaws.com"
    },
    "Action": "sts:AssumeRole"
}
```

<figure><img src="/files/vitFyQSA98OJvlnb1ajE" alt=""><figcaption><p>Edit trust policy</p></figcaption></figure>

8. After saving the changes, copy the **Role ARN** from the role summary and paste it into the **Datasaur Dinamic** extension.

   <figure><img src="/files/3U581yFj9gQwmoOH2BeA" alt=""><figcaption><p>Role summary</p></figcaption></figure>

## Start training

1. In the **Datasaur Dinamic** extension, enter the **AWS S3 Bucket Name** and the **Role ARN.**

   <figure><img src="/files/ivKBGSrr0dZ6e9QC13hS" alt=""><figcaption><p>Datasaur Dinamic with Amazon Sagemaker</p></figcaption></figure>
2. Click **Train** to start training with Amazon SageMaker Autopilot.

   <figure><img src="/files/FgnttSfclMcF2zHEcRuz" alt=""><figcaption><p>Datasaur Dinamic training progress</p></figcaption></figure>
3. After training is complete, the model name will appear in the extension. You can also find the trained model in your Amazon SageMaker model list.

   <figure><img src="/files/egzM8Cld65ryh2vf44Al" alt=""><figcaption><p>Datasaur Dinamic model name</p></figcaption></figure>
