2016-05-02 48 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哪個憑據集用於每個命令。