Amazon RedShift复制命令

时间:2014-07-21 08:16:35

标签: amazon-web-services amazon-s3 amazon-redshift

我正在使用此page上的数据来练习复制命令。

但我得到了例外

org.postgresql.util.PSQLException: ERROR: S3ServiceException:The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.,Status 301,Error PermanentRedirect,Rid 8D10A2C0B9C7570E,ExtRid VTQZsFdP8DRiJPza+Ko4bc2Y91P9Wra0Qb9C
  Detail: 
  -----------------------------------------------
  error:  S3ServiceException:The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.,Status 301,Error PermanentRedirect,Rid 8D10A2C0B9C7570E,ExtRid VTQZsFdP8DRiJPza+Ko4bc2Y91P9Wra0Qb9C
  code:      8001
  context:   Listing bucket=awssampledb prefix=tickit/allusers_pipe.txt
  query:     576
  location:  s3_utility.cpp:525
  process:   padbmaster [pid=4283]

我做错了什么?

3 个答案:

答案 0 :(得分:13)

S3存储桶和红移必须位于同一区域(美国东部):

  

此示例使用位于美国东部(弗吉尼亚北部)地区的Amazon S3存储桶。使用COPY命令加载数据时,包含数据的存储桶必须与群集位于同一区域。

如果您的红移群集位于其他区域,请查看Step 5: Load Sample Data from Amazon S3,使用 region-specific-bucket-name 滚动到该表:

------------------------------+-------------------------------+
| Region                      |  region-specific-bucket-name  |
------------------------------+-------------------------------+
| US East (Northern Virginia) |  awssampledb                  |
------------------------------+-------------------------------+
| US West (Oregon)            |  awssampledbuswest2           |
------------------------------+-------------------------------+
| EU (Ireland)                |  awssampledbeuwest1           |
------------------------------+-------------------------------+
| Asia Pacific (Singapore)    |  awssampledbapsoutheast1      |
------------------------------+-------------------------------+
| Asia Pacific (Sydney)       |  awssampledbapsoutheast2      |
------------------------------+-------------------------------+
| Asia Pacific (Tokyo)        |  awssampledbapnortheast1      |
------------------------------+-------------------------------+

答案 1 :(得分:1)

如下指定源区域

copy pep.test 
(operation, task_id, task_name)
from 's3://move-redshift-data-devo/move-redshift-data-devo/'
iam_role 'arn:aws:iam::355750824903:role/RedshiftDynamoDBAccess'
format as csv
region as 'us-east-1';

https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-source-s3.html#copy-region

答案 2 :(得分:-1)

s3 bucket和Redshift都应该在同一个区域。如果没有,则需要在复制命令中指定Region选项,然后加载才能正常工作。