Integrating S3 with ClickHouse

And then create a table on the new storage:

```
CREATE TABLE t
(
    a UInt64,
    s String
)
ENGINE = MergeTree
ORDER BY a
SETTINGS storage_policy = 's3_express';
```

### S3 storage[​](#s3-storage "Direct link to S3 storage")

S3 storage is also supported but only for `Object URL` paths. Example:

```
SELECT * FROM s3('https://test-bucket--eun1-az1--x-s3.s3express-eun1-az1.eu-north-1.amazonaws.com/file.csv', ...)
```

it also requires specifying bucket region in the config:

```
<s3>
    <perf-bucket-url>
        <endpoint>https://test-bucket--eun1-az1--x-s3.s3express-eun1-az1.eu-north-1.amazonaws.com</endpoint>
        <region>eu-north-1</region>
    </perf-bucket-url>
</s3>
```

### Backups[​](#backups "Direct link to Backups")

It is possible to store a backup on the disk we created above:

```
BACKUP TABLE t TO Disk('s3_express', 't.zip')

┌─id───────────────────────────────────┬─status─────────┐
│ c61f65ac-0d76-4390-8317-504a30ba7595 │ BACKUP_CREATED │
└──────────────────────────────────────┴────────────────┘
```

```
RESTORE TABLE t AS t_restored FROM Disk('s3_express', 't.zip')

┌─id───────────────────────────────────┬─status───┐
│ 4870e829-8d76-4171-ae59-cffaf58dea04 │ RESTORED │
└──────────────────────────────────────┴──────────┘
```

- [S3 table functions](#s3-table-functions)
  - [Preparation](#preparation)- [Reading Data from S3](#reading-data-from-s3)- [Using clickhouse-local](#using-clickhouse-local)- [Inserting Data from S3](#inserting-data-from-s3)- [Remote Insert using ClickHouse Local](#remote-insert-using-clickhouse-local)- [Exporting data](#exporting-data)- [Splitting large files](#splitting-large-files)- [Utilizing clusters](#utilizing-clusters)- [S3 table engines](#s3-table-engines)
    - [Reading data](#reading-data)- [Inserting data](#inserting-data)- [Managing credentials](#managing-credentials)- [Optimizing for performance](#s3-optimizing-performance)
        - [S3 storage tuning](#s3-storage-tuning)- [S3 backed MergeTree](#s3-backed-mergetree)
          - [Storage Tiers](#storage-tiers)- [Creating a disk](#creating-a-disk)- [Creating a storage policy](#creating-a-storage-policy)- [Creating a table](#creating-a-table)- [Modifying a table](#modifying-a-table)- [Handling replication](#handling-replication)- [Read & writes](#read--writes)- [Use S3 object storage as a ClickHouse disk](#configuring-s3-for-clickhouse-use)
            - [Configure ClickHouse to use the S3 bucket as a disk](#configure-clickhouse-to-use-the-s3-bucket-as-a-disk)- [Testing](#testing)- [Replicating a single shard across two AWS regions using S3 Object Storage](#s3-multi-region)
              - [Plan the deployment](#plan-the-deployment)- [Install software](#install-software)- [Create S3 buckets](#create-s3-buckets)- [Create an AWS IAM user](#create-an-aws-iam-user)- [Create an S3 bucket](#create-an-s3-bucket)- [Configure ClickHouse Keeper](#configure-clickhouse-keeper)- [Configure ClickHouse server](#configure-clickhouse-server)- [Configure networking](#configure-networking)- [Start the servers](#start-the-servers)- [Testing](#testing-1)- [S3Express](#s3express)
                - [S3 disk](#s3-disk)- [S3 storage](#s3-storage)- [Backups](#backups)

Was this page helpful?