> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roe-ai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS S3 Connector

> Connect AWS S3 to Roe AI

## Requirements

<AccordionGroup>
  <Accordion title="Create access credentials">
    Roe AI uses [programmatic access](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_identity-management.html?icmpid=docs_iam_console#AccessControlMethods)
    to connect to the S3 bucket. You create a new user in the
    [IAM Management Console](https://aws.amazon.com/iam/), assign in to a group,
    and then create a policy that grants access to the specified S3 bucket.

    **Create the policy**

    1. Add a new user through the IAM Management Console. You can add the user
       to an existing group or create a new group in which to add them. Once
       created, generate a set of [access keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html?icmpid=docs_iam_console#Using_CreateAccessKey)
       . You provide the access key and
       secret access key when creating an S3 resource in Roe AI.

    <img src="https://mintcdn.com/roeai/wyVOyeWPONjXHsrt/images/connect-s3-iam-access-key.png?fit=max&auto=format&n=wyVOyeWPONjXHsrt&q=85&s=9cc38997ca8242cc96c52a8cd19ba031" width="1858" height="366" data-path="images/connect-s3-iam-access-key.png" />

    2. Configure permissions for S3 buckets using [policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)
       . Create a new policy using the IAM Management Console that grants
       sufficient permission to read and write data to the S3 bucket.

    3. Use the console's GUI to create permissions or provide a JSON
       configuration. The following configuration grants access to read and write
       data for the specified S3 bucket. Update the BUCKET\_NAME placeholders with
       the name of your bucket.

    <img src="https://mintcdn.com/roeai/wyVOyeWPONjXHsrt/images/connect-s3-policy.png?fit=max&auto=format&n=wyVOyeWPONjXHsrt&q=85&s=5c0862cfc65c87db258e55b3e75480fd" width="2326" height="1556" data-path="images/connect-s3-policy.png" />

    ```json Example policy theme={null}
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "s3:ListBucket",
                    "s3:GetBucketAcl",
                    "s3:GetBucketCORS",
                    "s3:GetBucketLocation",
                    "s3:GetBucketLogging",
                    "s3:GetBucketNotification",
                    "s3:GetBucketPolicy",
                    "s3:GetBucketWebsite",
                    "s3:GetObject",
                    "s3:GetObjectAcl",
                    "s3:GetObjectVersion",
                    "s3:GetObjectVersionAcl",
                    "s3:PutObject",
                    "s3:PutObjectAcl",
                    "s3:PutObjectTagging",
                    "s3:PutObjectVersionAcl",
                    "s3:PutObjectVersionTagging"
                ],
                "Resource": [
                    "arn:aws:s3:::REPLACE_THIS_BUCKET_NAME",
                    "arn:aws:s3:::REPLACE_THIS_BUCKET_NAME/*"
                ]
            }
        ]
    }
    ```

    **Attach the policy**

    You can attach the policy to either the user or the group to which it
    belongs. Select the user group in which the user you created is assigned,
    then [attach the policy](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups_manage_attach-policy.html#).

    If you want to avoid having permanent permissions for the S3 bucket granted
    to your IAM user, you can configure the user to [assume a role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#)
    that has sufficient permissions.

    Once the policy is attached, you can create the S3 resource in Roe AI.
  </Accordion>
</AccordionGroup>

## Configure the resource

* **Name**: A unique name for the resource.
* **Description**: A description of the resource.
* **AWS Access Key**: The access key for the user you created in the IAM
  Management Console.
* **AWS Secret Key**: The secret access key for the user you created in the
  IAM Management Console.
* **Bucket Name**: The name of the S3 bucket you want to connect to.

## Test the connection

Click **Test Connection** to verify that Roe AI can successfully connect to the
data source. If the test fails, check the resource settings and try again.

## Save the resource

Click **Create resource** to complete the setup. You can now use the resource to
import data from the S3 bucket into the database.
