2016-05-02 45 views

回答

2

要复制本地

aws s3 sync s3://origin /local/path 

要复制到目标斗:

aws s3 sync /local/path s3://destination 
1

在AWS CLI允许您配置命名的配置文件,它可以让你使用一组不同的凭据为每个单独的CLI命令。这会很有帮助,因为您的存储分区处于不同的帐户。

要创建您的指定配置文件,您需要确保您的每个帐户都已拥有IAM用户,并且每个用户都需要一组访问密钥。像这样创建你的两个命名配置文件。

aws configure --profile profile1 
aws configure --profile profile2 

这些命令中的每一个都会询问您的访问密钥和要使用的默认区域。一旦你有你的两个配置文件,就像这样使用aws cli。

aws s3 cp s3://origin /local/path --recursive --profile profile1 
aws s3 cp /local/path s3://destination --recursive --profile profile2 

请注意,您可以使用--profile参数来告诉cli哪个凭据集用于每个命令。