# How to export data using \`COPY TO\` to non-Amazon object storage?

**URL:** <https://community.cratedb.com/t/how-to-export-data-using-copy-to-to-non-amazon-object-storage/902>\
**Category:** CrateDB\
**Created:** [November 19, 2021, 1:58pm UTC](https://community.cratedb.com/t/how-to-export-data-using-copy-to-to-non-amazon-object-storage/902 "2021-11-19T13:58:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emre\_Sevinc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/emre_sevinc/32/375_2.png) [@Emre\_Sevinc](https://community.cratedb.com/u/Emre_Sevinc)\
**Post date:** [November 19, 2021, 1:58pm UTC](https://community.cratedb.com/t/how-to-export-data-using-copy-to-to-non-amazon-object-storage/902/1 "2021-11-19T13:58:56Z")

</div>

Hello,

I’m running CrateDB version **4.6.3** and I’ve read the following:

- [COPY TO — CrateDB: Reference](https://crate.io/docs/crate/reference/en/4.6/sql/statements/copy-to.html)
- [Export table using COPY TO command to alternate S3 endpoint - #2 by miguel.arregui](https://community.cratedb.com/t/export-table-using-copy-to-command-to-alternate-s3-endpoint/246/2)

but I still couldn’t manage to export data to our S3-compatible object storage running in our data center (on-premise). It seems like CrateDB is trying to contact AWS endpoint, but I need it to contact our on-premise object storage.

I tried the following:

```auto
COPY emre.test_table_002 TO DIRECTORY 's3://access_key:secret_key@our.objectstorage.cloud/bucket001-benchmark/' ;

```

and received:

```auto
NotSerializableExceptionWrapper[amazon_s3_exception: The AWS Access Key Id you provided does not exist in our records. (Service: Amazon S3; Status Code: 403; Error Code: InvalidAccessKeyId; Request ID: K7FS0STJ2C38XGKQ; S3 Extended Request ID: oEir5xjpqyh+xGAtbAjjuSM+lUUlrRV75U2BSgCPQbh2e+NBnSkw8kourpXicD2xiiXgJPvpJuY=; Proxy: null)]

org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: amazon_s3_exception: The AWS Access Key Id you provided does not exist in our records. (Service: Amazon S3; Status Code: 403; Error Code: InvalidAccessKeyId; Request ID: K7FS0STJ2C38XGKQ; S3 Extended Request ID: oEir5xjpqyh+xGAtbAjjuSM+lUUlrRV75U2BSgCPQbh2e+NBnSkw8kourpXicD2xiiXgJPvpJuY=; Proxy: null)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1819)
...

```

That object storage is working, e.g. using [s5cmd](https://github.com/peak/s5cmd) I can interact with it such as:

```auto
$ s5cmd --no-verify-ssl --endpoint-url https://our.objectstorage.cloud ls s3://bucket001-benchmark
2020/06/02 08:39:20 1771503 file_01.pdf
2021/03/19 09:55:09 14149579439 file_02.tar.gz

```

And I can copy files to that object storage, again using [s5cmd](https://github.com/peak/s5cmd) like:

```auto
$ s5cmd --no-verify-ssl --endpoint-url https://our.objectstorage.cloud cp file03.tar.gz s3://bucket001-benchmark/

```

How can I make CrateDB use our S3-compatible object storage instead of AWS?

---

<div class="post-metadata">

**Author:** ![jayeff](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/jayeff/32/271_2.png) [@jayeff](https://community.cratedb.com/u/jayeff)\
**Post date:** [November 22, 2021, 10:14am UTC](https://community.cratedb.com/t/how-to-export-data-using-copy-to-to-non-amazon-object-storage/902/2 "2021-11-22T10:14:42Z")

</div>

Hi @Emre_Sevinc,

currently `COPY TO/FROM` is limited to AWS S3 and does not support S3-compatible options.

We have an open issue to support S3-compatiable alternatives ([Support setting a different endpoint for COPY TO / FROM for DNS-style S3 bucket adresses · Issue #11654 · crate/crate · GitHub](https://github.com/crate/crate/issues/11654)). This is planned for the CrateDB 4.8 release.

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [November 22, 2021, 6:57pm UTC](https://community.cratedb.com/t/how-to-export-data-using-copy-to-to-non-amazon-object-storage/902/3 "2021-11-22T18:57:32Z")

</div>

Actually this is already worked on, though I don’t want to make any promises when this will be released 🙂
