简体   繁体   English

带有命名配置文件的s3中的AWS Redshift复制命令

[英]AWS Redshift copy command from s3 with named profile

I can use AWS cli like this: 我可以这样使用AWS CLI:

aws --profile prfName s3 ls s3://mybucket

but when I use redshift like this: 但是当我这样使用redshift时:

copy eventStream.Events_Adobe
from 's3://cassemrtest/eventStream.csv'
region 'us-east-1'
credentials 'aws_access_key_id=xxxxxx;aws_secret_access_key=Rxxxxx[;token=xxxxxx]';

I get this error: 我收到此错误:

[Amazon](500310) Invalid operation: S3ServiceException:The request signature we calculated does not match the signature you provided. Check your key and signing method.,Status 403,Error SignatureDoesNotMatch,Rid xxxxxxxx,ExtRid xxxxxx
Details: 
 -----------------------------------------------
  error:  S3ServiceException:The request signature we calculated does not match the signature you provided. Check your key and signing method.,Status 403,Error SignatureDoesNotMatch,Rid xxxxx,ExtRid xxxxxx
  code:      8001
  context:   Listing bucket=cassemrtest prefix=eventStream.csv
  query:     1690
  location:  s3_utility.cpp:529
  process:   padbmaster [pid=25203]
  -----------------------------------------------;

Execution time: 0.3s
1 statement failed.

I think this is because I'm missing the profile name...how do I put in the profile name like I do when I use AWS CLI? 我认为这是因为我缺少配置文件名称...如何像使用AWS CLI一样输入配置文件名称?

The error indicates a bad set of credentials. 该错误表示一组错误的凭据。

The AWS Command-Line Interface (CLI) is used on a computer (either your own, or on Amazon EC2) to communicate with the AWS APIs. 在计算机(您自己的或在Amazon EC2上)上使用AWS命令行界面(CLI)与AWS API通信。 You can use a local credentials file to authenticate to AWS. 您可以使用本地凭证文件对AWS进行身份验证。 In your case, the credentials file contains multiple credentials stored as profiles, so the --profile parameter tells it which profile to use. 在您的情况下,凭证文件包含存储为配置文件的多个凭证,因此--profile参数告诉它使用哪个配置文件。

However, this credentials file is not used when sending commands to Amazon Redshift. 但是,在将命令发送到Amazon Redshift时使用此凭证文件。 Communications to Redshift is done via SQL rather than the AWS CLI. 与Redshift的通信是通过SQL而非AWS CLI进行的。

When using the Redshift COPY command, provide the Access Key and Secret Key directly, rather than referring to a credentials file. 使用Redshift COPY命令时,请直接提供访问密钥和秘密密钥,而不要引用凭据文件。 It should look something like: 它看起来应该像这样:

copy eventStream.Events_Adobe
from 's3://cassemrtest/eventStream.csv'
region 'us-east-1'
credentials 'aws_access_key_id=AKIAJ24FFOOBAR7VPMCT;aws_secret_access_key=2IpmAExampleKeyYsiXrqwyfza';

You most likely won't require the Token , since it is only used with temporary credentials. 您很可能不需要Token ,因为它仅与临时凭证一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM