# How to use Amazon S3 to receive data from Data Stream

import Tabs from '~/components/tabs/Tabs'


While configuring [streams](/en/documentation/products/observe/data-stream/), you need to set up a specific endpoint to stream your Azion data.

Continue reading for a step by step on how to connect an [Amazon S3](https://aws.amazon.com/s3/) endpoint to receive data from Data Stream.

---

## Amazon S3 requirements

:::note
The S3 credentials used with the endpoint must include the `s3:ListBucket` permission (to list and view objects within a bucket) and the `s3:PutObject` permission (to add or overwrite objects within a bucket), ensuring the necessary access for reading and writing operations in the information storage, including logs. Find out more about [S3 credentials](/en/documentation/products/store/storage/s3-protocol-for-object-storage/).
:::

To get started, you must complete a few configurations in **Amazon S3**:

1. Create an [Amazon AWS](https://portal.aws.amazon.com/billing/signup) account.
2. Register an [Identity and Access Management (IAM)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/setting-up-s3.html#create-an-iam-user-gsg) credential.
3. Create an [Amazon S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html).
4. Optionally, you can also [upload an object](https://docs.aws.amazon.com/AmazonS3/latest/userguide/uploading-an-object-bucket.html).
5. Optionally, you can set up and manage [Server Side Encryption (SSE)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html) with Amazon S3-Managed Keys (SSE-S3).

You'll also need to save and create the following information:

- Region
- Access Key
- Secret Key

### Region

This is the region where your Amazon S3 is running.

1. On the top bar of your dashboard, right next to the help button with the **'?'** icon, you find a dropdown menu, the Regions selector, where you can see the name of the region and its code.
2. Find the code and keep it to use it later. It looks similar to this: `us-east-1`

You can find more details on the AWS [Regions and Zones documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html).

### Access Key and Secret Key

1. Access the [Identify and Access Management (IAM)](https://us-east-1.console.aws.amazon.com/iam/home#/security_credentials$access_key) panel.
2. Click the **Create new access key** button.
3. A pop-up will appear on the screen with your key information.
4. Click on **Display Access Key** to display your key information as indicated below:
    - **Access Key ID**, with a format similar to `AKIA5LVCRTER524RAIA3`
    - **Secret Access Key**, with a format similar to `N9UTjunb299M5ryfKdG2cKh2+Pe2mBiGZXaBpVff`
5. Save the two keys information in a safe place to use them later on Azion Data Stream.

> You can also download the **EMP file** with the information for the keys.

For more details on setting up Amazon S3, see the [AWS documentation page](https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html).

---

## Configuring the endpoint in Data Stream

Next, follow these steps to configure the new endpoint you created in **Amazon S3** in your Azion **Data Stream**.

You can find detailed steps for the entire configuration on the [How to use Data Stream guide](/en/documentation/products/guides/use-data-stream/).

:::note
All `key` fields will be masked and an icon that allows revealing the field content will be only displayed to users with the `Edit Data Stream` permission. Users without the `Edit Data Stream` permission can only view the settings of the existing stream but not edit or create new ones.
:::

<Tabs client:visible>
    <Fragment slot="tab.console">Console</Fragment>
    <Fragment slot="tab.rtm">Real-Time Manager</Fragment>

<Fragment slot="panel.console">

In the **Destination** configurations:

1. On the **Connector** dropdown menu, select **Simple Storage Service (S3)**.
2. On **URL**, add the URL of your S3 host.
3. On **Bucket Name**, add the name of your S3 bucket on AWS.
4. On **Region**, add the region configured on AWS.
5. On **Access Key**, add the access key you created on AWS.
6. On **Secret Key**, add the secret key you created on AWS.
7. On **Object Key Prefix** (optional), add the prefix for the name of your uploaded object. Example: `user/logs`.
8. On **Content Type**, add the format of the object that'll be created in your S3 bucket. It can be **plain/text** or **application/gzip**.
9. Make sure the **Active** switch is on.
10. Click the **Save** button.

</Fragment>

<Fragment slot="panel.rtm">

1. On the **Endpoint Type** dropdown menu, select **Simple Storage Service (S3)**.
2. On **Host URL**, add the URL of your S3 host.
3. On **Bucket Name**, add the name of your S3 bucket on AWS.
4. On **Region**, add the region configured on AWS.
5. On **Access Key**, add the access key you created on AWS.
6. On **Secret Key**, add the secret key you created on AWS.
7. On **Object Key Prefix** (optional), add the prefix for the name of your uploaded object. Example: `user/logs`.
8. On **Content Type**, add the format of the object that'll be created in your S3 bucket. It can be **plain/text** or **application/gzip**.
9. Make sure the **Active** switch is on.
10. Click the **Save** button.
</Fragment>

</Tabs>

:::note
The **Object Key Prefix** field refers to the prefix for the name of your uploaded object. The file name is composed of the Prefix, the date and time the packets are sent in the YYYY/MM/DD/hh/mm/ format, and the UUID. Example: `user/logs/2024/10/12/06/24/37d66e78-c308-4006-9d4d-1c013ed89276`.
:::

After saving the configurations, your data will be streamed to the newly configured endpoint.

You can keep track of the calls made by Data Stream to Amazon S3 on [Real-Time Events](/en/documentation/products/observe/real-time-events/). To do so, select **Data Source** > **Data Stream** and choose the filters options as you wish.

Watch a video tutorial on how to use Amazon S3 with Data Stream on Azion’s YouTube channel:

<Video src="https://www.youtube.com/embed/tuUanVc_HFE?si=3-oG5BiHElJzb63-" title="How to use Amazon S3 to receive data from Data Stream" description="Hands-on to configure Amazon S3 to receive data from Data Stream." uploadDate="2023-07-03" />

---

## Trademarks

[Amazon Simple Storage Service](https://aws.amazon.com/s3/) is a registered trademark of Amazon Web Services in the United States and other countries.