> For the complete documentation index, see [llms.txt](https://tricks.bodik.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tricks.bodik.tech/databases/clickhouse/attach-s3-as-a-storage-engine-to-clickhouse.md).

# Attach S3 as a storage engine to ClickHouse

You can move part of your data to S3 by easily connecting your S3 bucket to your ClickHouse table.

You can configure your server using this example:

```xml
<clickhouse>
    <storage_configuration>
        ...
        <disks>
            <s3>
                <type>s3</type>
                <endpoint>https://sample-bucket.s3.us-east-2.amazonaws.com/tables/</endpoint>
                <access_key_id>your_access_key_id</access_key_id>
                <secret_access_key>your_secret_access_key</secret_access_key>
                <region></region>
                <metadata_path>/var/lib/clickhouse/disks/s3/</metadata_path>
                <cache_enabled>true</cache_enabled>
            <data_cache_enabled>true</data_cache_enabled>   
                <cache_path>/var/lib/clickhouse/disks/s3/cache/</cache_path>
            </s3>
        </disks>
        ...
    </storage_configuration>
</clickhouse>
```

After modification you obviously need to restart your server.&#x20;

To attach your connected S3 bucket to the table, you can use this instruction:

{% content-ref url="/pages/pWnRyVrfRWSBkmC95ATK" %}
[Table with TTL to S3](/databases/clickhouse/table-with-ttl-to-s3.md)
{% endcontent-ref %}

More information is available here:

{% embed url="<https://clickhouse.com/docs/en/integrations/s3/s3-merge-tree/>" %}
