When I launch a cluster in the AWS Beijing Region using Hive and Presto to create an external table from an S3 bucket, and then I query a table using Hive and Presto, I receive an error similar to the following: 

presto:default> select * from mydata;

Query 20160712_072348_00009_qqx96, FAILED, 1 node

Splits: 1 total, 0 done (0.00%)

0:03 [0 rows, 0B] [0 rows/s, 0B/s]

Query 20160712_072348_00009_qqx96 failed: The provided token is malformed or otherwise invalid. (Service: Amazon S3; Status Code: 400; Error Code: InvalidToken; Request ID: 841753ED1D9E8250)

This can occur because Presto doesn’t support the Amazon S3 region automatically, so it is unable to locate the S3 bucket in the cn-north-1 region.

  1. Set hive.s3.pin-client-to-current-region in the hive.properties file to true

$ sudo vim /etc/presto/conf/catalog/hive.properties

hive.s3.connect-timeout=2m

hive.s3.max-backoff-time=10m

...

hive.s3.pin-client-to-current-region=true

  2. Restart Presto.

Use one of the following procedures when launching new clusters by using the AWS Management Console or AWS CLI.

  1. Open the EMR console, choose Create cluster, and then choose Go to advanced options.
  2. In the Edit software settings section, choose Enter configuration and then enter the following command in the configuration field:
        classification=presto-connector-hive,properties=[hive.s3.pin-client-to-current-region=True]
  3. Choose Next and complete the cluster setup wizard. For additional information, see Create a Cluster.

When you create an EMR cluster with the AWS CLI, include the following for the --configurations parameter:

[

    {

        "Classification":"presto-connector-hive",

        "Properties":{"hive.s3.pin-client-to-current-region":"true"}

    }

]

You should now be able to successfully launch a cluster using Hive and Presto in the AWS Beijing Region.

Amazon EMR, Hive, Presto


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-12-30