Skip to content

Commit ad3f616

Browse files
authored
Merge pull request #143 from tigergraph/DOC-3114-added-s3_region-to-savanna-page
DOC-3114: Added s3_region to Savanna
2 parents bdd47be + 3b7ee25 commit ad3f616

1 file changed

Lines changed: 32 additions & 17 deletions

File tree

  • modules/savanna/modules/graph-development/pages/advanced-features

modules/savanna/modules/graph-development/pages/advanced-features/write2-s3.adoc

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,34 @@ There are three main methods to write data to S3 from TigerGraph Savanna:
3131

3232
Set your AWS credentials and query timeout in the GSQL Editor.
3333

34-
```sql
34+
[source,gsql]
35+
----
3536
set query_timeout=7200000;
3637
set s3_aws_access_key_id = <AWS_KEY_ID>;
3738
set s3_aws_secret_access_key = <AWS_ACCESS_KEY>;
38-
```
39+
set s3_region = <REGION>;
40+
----
41+
42+
[NOTE]
43+
====
44+
The `s3_region` parameter specifies the AWS region where your S3 bucket is located. If you don't set this parameter, it defaults to `us-east-1`. Set the correct region to successfully write data to your S3 bucket. For example, if your bucket is in `us-west-2`, set `s3_region = "us-west-2"`.
45+
====
3946

4047
4) **Create and Run the Query**:
4148

4249
Create a query to write data to S3 and run it.
4350

44-
```sql
51+
[source,gsql]
52+
----
4553
CREATE QUERY print_to_csv_s3() FOR GRAPH ldbc_snb {
4654
FILE f_hello ("s3://<s3_path>/" + "f_hello.csv");
4755
print "f_hello", "world\n" TO_CSV f_hello;
4856
}
4957
5058
run query print_to_csv_s3();
51-
```
59+
----
5260

53-
Replace `<AWS_KEY_ID>`, `<AWS_ACCESS_KEY>`, and `<s3_path>` with your actual AWS credentials and S3 path.
61+
Replace `<AWS_KEY_ID>`, `<AWS_ACCESS_KEY>`, and `<s3_path>` with your actual AWS credentials, S3 region, and S3 path.
5462

5563
=== Method 2: Via API
5664

@@ -60,15 +68,17 @@ Replace `<AWS_KEY_ID>`, `<AWS_ACCESS_KEY>`, and `<s3_path>` with your actual AWS
6068

6169
Use the following curl command to run the query via API.
6270

63-
```shell
71+
[source,bash]
72+
----
6473
curl -X GET \
6574
-H "GSQL-S3AWSAccessKeyId: $AWS_KEY_ID" \
6675
-H "GSQL-S3AWSSecretAccessKey: $AWS_ACCESS_KEY" \
76+
-H "GSQL-S3Region: $S3_REGION" \
6777
-H "GSQL-TIMEOUT: 7200000" \
6878
https://$HOST_ID.i.tgcloud.io/query/$GRAPH_NAME/$QUERY_NAME
69-
```
79+
----
7080

71-
Replace `$AWS_KEY_ID` and `$AWS_ACCESS_KEY` with your actual AWS credentials, `$HOST_ID` with your TigerGraph Savanna host ID, `$GRAPH_NAME` with your graph name, and `$QUERY_NAME` with your query name.
81+
Replace `$AWS_KEY_ID` and `$AWS_ACCESS_KEY` with your actual AWS credentials, `$S3_REGION` with your S3 bucket region (for example, `us-west-2`), `$HOST_ID` with your TigerGraph Savanna host ID, `$GRAPH_NAME` with your graph name, and `$QUERY_NAME` with your query name.
7282

7383
=== Method 3: Using Graph Admin
7484

@@ -94,33 +104,38 @@ It is recommended to always set up a default s3 access key ID and secret access
94104

95105
[NOTE]
96106
====
97-
Update Graph Admin configurations may require restart of certain services, which may impact the running queries/loading jobs/schema changes. Apply changes with caution.
107+
Update Graph Admin configurations may require restart of certain services, which may impact the running queries, loading jobs, or schema changes. Apply changes with caution.
108+
109+
The Graph Admin method does not support setting the `s3_region` parameter. To specify a region other than the default `us-east-1`, use Method 1 (GSQL Editor) or Method 2 (API).
98110
====
99111

100112

101113
=== Example
102114

103-
Here’s an example of writing data to S3 using the GSQL Editor:
104-
105-
```sql
115+
Here’s a complete example of writing data to S3 using the GSQL Editor with all required parameters:
106116

117+
[source,gsql]
118+
----
107119
set query_timeout=7200000;
108120
set s3_aws_access_key_id = "your_aws_access_key_id";
109121
set s3_aws_secret_access_key = "your_aws_secret_access_key";
122+
set s3_region = "us-east-1";
110123
111124
CREATE QUERY print_to_csv_s3() FOR GRAPH ldbc_snb {
112125
FILE f_hello ("s3://your_s3_bucket/your_path/" + "f_hello.csv");
113126
print "f_hello", "world\n" TO_CSV f_hello;
114127
}
115128
116129
run query print_to_csv_s3();
130+
----
117131

118-
```
132+
Replace `us-east-1` with the actual region of your S3 bucket.
119133

120134
== Troubleshooting
121135

122-
- **Permission Issues**: Ensure that the IAM role or user has the necessary permissions (`s3:PutObject`, `s3:ListBucket`).
123-
- **Network Issues**: Verify that your TigerGraph workspace can reach the S3 endpoint.
124-
- **Credential Issues**: Ensure that the correct credentials are provided either via GSQL Editor, API headers, or Graph Admin configurations.
136+
* *Permission Issues*: Ensure that the IAM role or user has the necessary permissions (`s3:PutObject`, `s3:ListBucket`).
137+
* *Network Issues*: Verify that your TigerGraph workspace can reach the S3 endpoint.
138+
* *Credential Issues*: Ensure that the correct credentials are provided either via GSQL Editor, API headers, or Graph Admin configurations.
139+
* *Region Mismatch*: If you receive errors when writing to S3, verify that the `s3_region` parameter matches the actual region of your S3 bucket. Using the wrong region will cause the write operation to fail.
125140

126-
For more detailed troubleshooting, refer to the [AWS S3 Documentation](https://docs.aws.amazon.com/s3/index.html).
141+
For more detailed troubleshooting, refer to the [AWS S3 Documentation](https://docs.aws.amazon.com/s3/index.html).

0 commit comments

Comments
 (0)