# Amazon S3

## Steps to configure Amazon S3 destination

### Pre-Requisites

1. Access to Amazon Web Services
2. Access to Daton to configure the destination
3. Permissions to manage S3 buckets in AWS

> ### Once the pre-requisites are cleared, follow the steps below to configure S3 as a destination in Daton

### Setups in S3

#### Step1 - Create an S3 Bucket

* Use the search functionality on your AWS console to easily navigate to the S3 Setup console.
* Create a Storage Bucket or Use an existing Storage Bucket depending on your requirements
* Skip to step 3 if you already have a bucket

![Create an S3 bucket where the data will be loaded](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbJ1eMq5M51cIpU163R%2F-MOasFhS4uNjJWrLz-uW%2F-MOawX-djR0YmxCb-xBL%2F2020-12-15%20at%209.07%20AM.png?alt=media\&token=f26c4cbd-56c4-4274-95af-7e5361d5f0aa)

Enter the bucket name and select the appropriate options to define the bucket parameters according to your organization preference.&#x20;

![](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbJ1eMq5M51cIpU163R%2F-MOasFhS4uNjJWrLz-uW%2F-MOawxYBbTwuk4geDbN6%2F2020-12-15%20at%209.10%20AM.png?alt=media\&token=10535c34-844b-4b5e-aa5e-c126e4c1f5c4)

#### Step2 - Granting Bucket Permissions

One the bucket is created, grant permissions to Daton to create and manage files in this bucket.

![](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbJ1eMq5M51cIpU163R%2F-MOasFhS4uNjJWrLz-uW%2F-MOayRt1EZ_so2UaUiR4%2Fimage.png?alt=media\&token=d6732d9d-a11c-47f1-aa62-d8dd7e9d81a5)

![](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbJ1eMq5M51cIpU163R%2F-MOasFhS4uNjJWrLz-uW%2F-MOayjh5VoxjPPlTM0WP%2Fimage.png?alt=media\&token=1133df0e-7e4c-4c51-a6d9-a6491439a67a)

Edit the bucket policy and add the following JSON to the policy after changing the bucket name to reflect the bucket where you want data loaded.

```
{
  "Version": "2012-10-17",
  "Id": "",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "AWS": [
          "arn:aws:iam::214669062314:role/Warehouse"
        ]
      },
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:ListBucket"
        ],
      "Resource": [
        "arn:aws:s3:::<YOUR_BUCKET_NAME>",
        "arn:aws:s3:::<YOUR_BUCKET_NAME>/*"
      ]
    }
  ]
}
```

![Save the permissions to the bucket](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbJ1eMq5M51cIpU163R%2F-MOasFhS4uNjJWrLz-uW%2F-MOaz8YZFkTeUiexW8gi%2Fimage.png?alt=media\&token=6ac7246e-a8ae-4902-8771-1ca087b6337f)

### Setups in Daton

The steps laid out earlier in the document are a pre-requisite before you start configuring S3 as a destination in Daton.&#x20;

Enter an integration name to identify the warehouse in Daton.&#x20;

![](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbJ1eMq5M51cIpU163R%2F-MX-g3RBAPt4M0mHo3GG%2F-MX-g7bMdntjpH7N4hvA%2F2021-03-29%20at%208.11%20PM.png?alt=media\&token=3520b283-dfb4-404d-a1b7-c88743ffd4bb)

Enter S3 parameters that will determine how the data will be populated in the S3 buckets.

1. Select the region in which you have created the bucket.&#x20;
2. Enter the bucket name that is going to host the files replicated by Daton
3. Enter the Object Key Prefix&#x20;
4. Currently, we support CSVs, Parquet and JSON for S3 buckets. If you need support for any other format, do write to us at <support@sarasanalytics.com>

![](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbJ1eMq5M51cIpU163R%2F-MX-g3RBAPt4M0mHo3GG%2F-MX-gKVLCqNga2C7DBR5%2F2021-03-29%20at%208.13%20PM.png?alt=media\&token=b4936b33-81df-4a66-b714-53952ff3842c)

5\. Optionally you can add the additional keys to Object key prefix by selecting optional key elements field.

6\. The time zone used is UTC.

![](https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2F7dLs8wX7soI8WfTnT0NX%2Fimage.png?alt=media\&token=a894a68d-52e4-4ba3-b0c4-77234354bf46)

7\. They key would have the following format if all the optional elements are selected:\
&#x20;   \[*object\_key\_prefix]/\[integration\_name]/\[tablename]/\[year]/\[month]/\[day]/\[hour]/\[timestamp.filetype]*\
If only a combination of elements are selected then the order of optional elements in the key will be in descending order of the time period.
