将数据从 S3 复制到 Redshift

Copying data from S3 to Redshift

我觉得这应该比在我身上容易得多。

copy table
from 's3://s3-us-west-1.amazonaws.com/bucketname/filename.csv'
CREDENTIALS 'aws_access_key_id=my-access;aws_secret_access_key=my-secret'
REGION 'us-west-1';

请注意,我在遇到问题后添加了 REGION 部分,但什么也没做。

不过让我感到困惑的是,在存储桶属性中只有 https://path/to/the/file.csv。我只能假设我已阅读的所有文档都要求路径以 s3://... 开头,我只是将 https 更改为 s3,如我的示例所示。

但是我得到这个错误:

"Error : 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"

我正在使用 Navicat for PostgreSQL 连接到 Redshift,我 运行 在 mac.

是的,应该更容易:-)

我只在您的 S3 存储桶不是美国标准时看到此错误。在这种情况下,您需要使用基于端点的地址,例如http://s3-eu-west-1.amazonaws.com/mybucket/myfile.txt.

您可以在此文档页面中找到您所在地区的端点, http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

S3 路径应该是 's3://bucketname/filename.csv'。试试这个。