# Connecting with AWS storage

To connect your AWS account with Mindkosh and add data, you first need to add your AWS credentials.&#x20;

## Create an IAM user on AWS

Create an IAM user on AWS, and attach a policy with read access rights over the bucket and location you intend to use. When asked to choose the AWS credential type. select **Access key - Programmatic access**. We do not require AWS console access.

An example policy you can attach to the new user is given below. Be sure to replace *example-bucket* with your own bucket name.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Resource": [
                "arn:aws:s3:::<example-bucket>"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::<example-bucket>/*"
            ]
        }
    ]
}

```

{% hint style="warning" %}

#### Remember to save the API Access keys

Once you have created a new user, you will be prompted to save the Access keys you just created. Make sure to click on the "**Download .csv**" button. If you close the tab, and reopen it, you will not be able to view the Secret access key required to access data from your bucket.
{% endhint %}

##

## Set CORS policy

In order to enable the browser to directly fetch the files from your cloud storage, you will need to set the right CORS policy on the bucket, so the browser does not block loading the files. Here is how you can do it for a bucket on AWS S3.

<figure><img src="https://4219847035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaFKXVbOeJ2H3b8HBGVBG%2Fuploads%2FltvF675Ynt1mKKH9RzYQ%2Fsetting-cors-on-s3-to-connect-to-mindkosh.jpg?alt=media&#x26;token=ec009cd9-6399-4f1e-8aaf-6ad6d6fe9139" alt="Permissions section on a AWS s3 bucket"><figcaption></figcaption></figure>

1. Open the bucket on the AWS console.
2. Switch to the Permissions tab.
3. Scroll down to the CORS section and enter the following policy.

```json
[
    {
        "AllowedHeaders": [
            "Access-Control-Allow-Origin"
        ],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "https://app.mindkosh.com",
        ],
        "ExposeHeaders": [
            "Access-Control-Allow-Origin"
        ]
    }
]
```

## Add credentials to Mindkosh

{% hint style="danger" %}
Only organization admins can add cloud storage credentials on Mindkosh&#x20;
{% endhint %}

With the permissions setup, we are now ready to add the credentials to Mindkosh. To add cloud storage credentials, go to the Organization page from the left sidebar on Mindkosh.&#x20;

<figure><img src="https://4219847035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaFKXVbOeJ2H3b8HBGVBG%2Fuploads%2F7NigpzmfdEMsIqUnmOHo%2Fimage.png?alt=media&#x26;token=30c4ea19-bb9b-40e9-831e-09b3d5b8d6bc" alt=""><figcaption></figcaption></figure>

Click on the Manage Keys button in the AWS S3 section, and enter the following keys in the appropriate boxes:

1. `Access key ID`
2. `Secret Access key`

Once the credentials have been setup, you can create a dataset to add data from your storage. [Checkout the steps mentioned here to do this.](https://docs.mindkosh.com/management/uploading-data#adding-data-from-aws-s3)
