# How to Integrate Amazon Marketing Streams with Daton

### Pre-Requisites <a href="#pre-requisites" id="pre-requisites"></a>

Before starting, ensure you have&#x20;

* An active Daton account.&#x20;
* An AWS account configured with the following:&#x20;
  * 'Daton' set up as a trusted entity for an IAM role.&#x20;
  * SQS timeout set for 12 hours.

    <figure><img src="https://1084021496-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FZAlhIoGEMFHZMIAH1PXs%2FAMS%20SQS%20Prerequisites.jpeg?alt=media&#x26;token=5e9c9847-e330-4141-9c2f-42c737c58078" alt=""><figcaption></figcaption></figure>

### **Task 1: Create a new role to access SQS (Amazon Simple Queue Service)**

1. Sign in to the AWS console and navigate to IAM (Identity and Access Management).
2. Select **Role** from **the Access Management** menu and click **Create Role**.

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FZrCdqhyhUH88PtsdgfUC%2Fimage.png?alt=media&#x26;token=19c19fef-722e-47aa-8754-e93789864b5a" alt=""><figcaption></figcaption></figure>
3. Select **AWS account** for Trusted Entity Type and use the account ID- **214669062314.**

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FlSEfcgZp93vYCEiVrIbh%2Fimage.png?alt=media&#x26;token=5a55cd00-8e42-4447-87b0-eb12cf95a787" alt=""><figcaption></figcaption></figure>

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FQhe2GJftFq842DLVubce%2Fimage.png?alt=media&#x26;token=17b103f9-ef8a-4be8-a137-88b97b4f2510" alt=""><figcaption></figcaption></figure>
4. Add AmazonSQSFullAccess permissions - Search for 'sqs' and select AmazonSQSFullAccess from the list. \
   \&#xNAN;*Full access is required as Daton would create and manage SQS programmatically, for each of the Ad profiles and marketplaces.*

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FxLkzotAXZKKdrQFMDpjS%2Fimage.png?alt=media&#x26;token=2584efac-de97-4c2d-aa03-9fb325b82a02" alt=""><figcaption></figcaption></figure>
5. Provide a **Name** for the Role and click **Create role**.

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FyoBeolOxUvzhuN2tiMs9%2Fimage.png?alt=media&#x26;token=1072d692-7e0f-4e83-a49c-c89af19b8fe8" alt=""><figcaption></figcaption></figure>

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FFXHzNcOE28dtMUW6XT1J%2Fimage.png?alt=media&#x26;token=4b8f167b-5c2e-4f45-8d60-0b87bbe17c38" alt=""><figcaption></figcaption></figure>

### Task 2: Update the Trust Policy for the Role

1. Click on the role that you created earlier. Go to the **Trust Relationships** tab and click on **Edit Trust Policy.**&#x20;

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FqUzSJpaBT0sRcZogeniw%2Fimage.png?alt=media&#x26;token=c1ada53b-09ce-4408-93de-82d60f1ce9da" alt=""><figcaption></figcaption></figure>

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2FXodlVaAUQNSCMe6OtsHJ%2Fimage.png?alt=media&#x26;token=3796cf10-beba-407c-af23-e3796fc00b43" alt=""><figcaption></figcaption></figure>
2. Replace the existing policy with the following and save the policy.

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::214669062314:user/DatonSQSAccess"
            },
            "Action": "sts:AssumeRole",
            "Condition": {}
        }
    ]
}
```

### Task 3: Update SQS timeouts

1. Go to the SQS role and click **Edit.**
2. Update Maximum Session Duration to 12 Hours.

   <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2F83xaba5T3MtGi6I80PCf%2Fimage.png?alt=media&#x26;token=6cd91e02-dafc-4644-b64c-1d190ad9b57f" alt=""><figcaption></figcaption></figure>

### Task &#x34;**:** Integrate Daton with Amazon Marketing Streams

1. Log in to your [Daton account](https://daton.sarasanalytics.com/u/integrations-list) and search for Amazon Marketing Streams in the list of Connectors, then click **Configure**.
2. Enter the following details and click **Authenticate**:&#x20;
   * Integration Name\
     Note that the Integration Name will be used to create the integration tables and cannot be modified later.
   * Regions and Marketplaces
   * Role ARN: Find the ARN in Amazon AWS IAM that matches the role you created in Task 1. Copy and paste it into this field.

     <figure><img src="https://15515196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbJ1eMq5M51cIpU163R%2Fuploads%2Fam4pAvdyNtXjV5FTThkM%2FAMS.png?alt=media&#x26;token=39e0858a-b8fc-4b12-bde9-35d2aec26062" alt=""><figcaption></figcaption></figure>
3. Post Authentication, select Ad accounts from the list, and submit the configuration.
4. Select the destination for extracting data for replication and relax.\
   Daton takes care of the further process, handling the creation of queues, establishing subscriptions to streams, and ensuring effective queue management throughout the data retrieval and integration process.

{% hint style="info" %}
**Note**&#x20;

Subscribing to streams in Amazon Marketing Streams through Daton may take up to 2 hours for completion. To track the status of your subscriptions, edit the integration and navigate to the subscription list page within the Daton platform.
{% endhint %}
