Skip to content

Commit 9f00c40

Browse files
dulao5ti-chi-bot
authored andcommitted
external storage url in tidb cloud (pingcap#21058)
1 parent 84ab22e commit 9f00c40

File tree

3 files changed

+38
-22
lines changed

3 files changed

+38
-22
lines changed

external-storage-uri.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ The basic format of the URI is as follows:
1515

1616
## Amazon S3 URI format
1717

18+
<CustomContent platform="tidb">
19+
1820
- `scheme`: `s3`
1921
- `host`: `bucket name`
2022
- `parameters`:
@@ -48,12 +50,42 @@ tiup cdc:v7.5.0 cli changefeed create \
4850
--config=cdc_csv.toml
4951
```
5052

51-
The following is an example of an Amazon S3 URI for [`IMPORT INTO`](/sql-statements/sql-statement-import-into.md). In this example, you need to specify a specific filename `test.csv`.
53+
</CustomContent>
54+
55+
<CustomContent platform="tidb-cloud">
56+
57+
- `scheme`: `s3`
58+
- `host`: `bucket name`
59+
- `parameters`:
60+
61+
- `access-key`: Specifies the access key.
62+
- `secret-access-key`: Specifies the secret access key.
63+
- `session-token`: Specifies the temporary session token.
64+
- `use-accelerate-endpoint`: Specifies whether to use the accelerate endpoint on Amazon S3 (defaults to `false`).
65+
- `endpoint`: Specifies the URL of custom endpoint for S3-compatible services (for example, `<https://s3.example.com/>`).
66+
- `force-path-style`: Use path style access rather than virtual hosted style access (defaults to `true`).
67+
- `storage-class`: Specifies the storage class of the uploaded objects (for example, `STANDARD` or `STANDARD_IA`).
68+
- `sse`: Specifies the server-side encryption algorithm used to encrypt the uploaded objects (value options: empty, `AES256`, or `aws:kms`).
69+
- `sse-kms-key-id`: Specifies the KMS ID if `sse` is set to `aws:kms`.
70+
- `acl`: Specifies the canned ACL of the uploaded objects (for example, `private` or `authenticated-read`).
71+
- `role-arn`: To allow TiDB Cloud to access Amazon S3 data using a specified [IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html), specify the corresponding [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) of the IAM role using the `role-arn` URL query parameter, such as `arn:aws:iam::888888888888:role/my-role`.
72+
73+
> **Note:**
74+
>
75+
> - To automatically create an IAM role, navigate to the **Import Data from Amazon S3** page of your cluster in the [TiDB Cloud console](https://tidbcloud.com/), fill in the **Folder URI** field, click **Click here to create new one with AWS CloudFormation** under the **Role ARN** field, and then follow the on-screen instructions in the **Add New Role ARN** dialog.
76+
> - If you have any trouble creating the IAM role using AWS CloudFormation, click **click Having trouble? Create Role ARN manually** in the **Add New Role ARN** dialog to get the TiDB Cloud Account ID and TiDB Cloud External ID, and then follow the steps in [Configure Amazon S3 access using a Role ARN](/tidb-cloud/dedicated-external-storage.md#configure-amazon-s3-access-using-a-role-arn) to create the role manually. When configuring the IAM role, make sure to enter the TiDB Cloud account ID in the **Account ID** field and select **Require external ID** to protect against [confused deputy attacks](https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html).
77+
> - To enhance security, you can reduce the valid duration of the IAM role by configuring a shorter **Max session duration**. For more information, see [Update the maximum session duration for a role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_update-role-settings.html#id_roles_update-session-duration) in AWS documentation.
78+
79+
- `external-id`: To allow TiDB Cloud to access Amazon S3 data, you must specify the TiDB Cloud External ID using the `external-id` parameter. You can get the TiDB Cloud External ID from the **Add New Role ARN** dialog in the [TiDB Cloud console](https://tidbcloud.com/). For more information, see [Configure Amazon S3 access using a Role ARN](/tidb-cloud/dedicated-external-storage.md#configure-amazon-s3-access-using-a-role-arn).
80+
81+
The following is an example of an Amazon S3 URI for [`BACKUP`](/sql-statements/sql-statement-backup.md) and [`RESTORE`](/sql-statements/sql-statement-restore.md). In this example, you need to specify a specific file path `testfolder`.
5282

5383
```shell
54-
s3://external/test.csv?access-key=${access-key}&secret-access-key=${secret-access-key}
84+
s3://external/testfolder?access-key=${access-key}&secret-access-key=${secret-access-key}
5585
```
5686

87+
</CustomContent>
88+
5789
## GCS URI format
5890

5991
- `scheme`: `gcs` or `gs`
@@ -64,12 +96,16 @@ s3://external/test.csv?access-key=${access-key}&secret-access-key=${secret-acces
6496
- `storage-class`: Specifies the storage class of the uploaded objects (for example, `STANDARD` or `COLDLINE`)
6597
- `predefined-acl`: Specifies the predefined ACL of the uploaded objects (for example, `private` or `project-private`)
6698

99+
<CustomContent platform="tidb">
100+
67101
The following is an example of a GCS URI for TiDB Lightning and BR. In this example, you need to specify a specific file path `testfolder`.
68102

69103
```shell
70104
gcs://external/testfolder?credentials-file=${credentials-file-path}
71105
```
72106

107+
</CustomContent>
108+
73109
The following is an example of a GCS URI for [`IMPORT INTO`](/sql-statements/sql-statement-import-into.md). In this example, you need to specify a specific filename `test.csv`.
74110

75111
```shell

sql-statements/sql-statement-backup.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,8 @@ BR supports backing up data to S3 or GCS:
117117
BACKUP DATABASE `test` TO 's3://example-bucket-2020/backup-05/?access-key={YOUR_ACCESS_KEY}&secret-access-key={YOUR_SECRET_KEY}';
118118
```
119119

120-
<CustomContent platform="tidb">
121-
122120
The URL syntax is further explained in [URI Formats of External Storage Services](/external-storage-uri.md).
123121

124-
</CustomContent>
125-
126-
<CustomContent platform="tidb-cloud">
127-
128-
The URL syntax is further explained in [external storage URI](https://docs.pingcap.com/tidb/stable/external-storage-uri).
129-
130-
</CustomContent>
131-
132122
When running on cloud environment where credentials should not be distributed, set the `SEND_CREDENTIALS_TO_TIKV` option to `FALSE`:
133123

134124
{{< copyable "sql" >}}

sql-statements/sql-statement-restore.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,8 @@ BR supports restoring data from S3 or GCS:
108108
RESTORE DATABASE * FROM 's3://example-bucket-2020/backup-05/';
109109
```
110110

111-
<CustomContent platform="tidb">
112-
113111
The URL syntax is further explained in [URI Formats of External Storage Services](/external-storage-uri.md).
114112

115-
</CustomContent>
116-
117-
<CustomContent platform="tidb-cloud">
118-
119-
The URL syntax is further explained in [external storage URI](https://docs.pingcap.com/tidb/stable/external-storage-uri).
120-
121-
</CustomContent>
122-
123113
When running on cloud environment where credentials should not be distributed, set the `SEND_CREDENTIALS_TO_TIKV` option to `FALSE`:
124114

125115
{{< copyable "sql" >}}

0 commit comments

Comments
 (0)