【发布时间】:2018-04-10 17:18:22
【问题描述】:
我必须将文件从一个 s3 存储桶复制到另一个。源存储桶中有许多文件夹,我们只需从每个文件夹中选择一个文件。例如,下面是示例结构-
s3://mysrcbucket/CustomerID1/File1
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File1
s3://mysrcbucket/CustomerID2/File2
s3://mysrcbucket/CustomerID2/File3
我已经准备了一个清单列表(将在 s3distcp 中使用),其中包含我需要为每个客户复制的文件的名称,例如 -
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File3
由于每个客户只需要复制一个文件,因此应将目标文件名转换为相应的客户ID。有点像-
Expected Result
s3://mytrgtbucket/CustomerID1 (this will hold the content of file-CustomerID1/File2)
s3://mytrgtbucket/CustomerID2 (this will hold the content of file-CustomerID2/File3)
我在这里使用 groupby 子句,我可以创建带有客户 ID 的文件,但它会创建另一个带有 CustomerID 的文件夹,例如-
Current Result
s3://mytrgtbucket/CustomerID1/CustomerID1
s3://mytrgtbucket/CustomerID2/CustomerID2.
我使用的命令是-
s3-dist-cp --src=s3://mysrcbucket/ --dest=s3://mytrgtbucket/ --copyFromManifest --previousManifest=s3://mysrcbucket/manifest.gz --groupBy='.*(CustomerID\d)/.*'
有什么办法可以实现预期结果,而不是当前结果。 p>
【问题讨论】:
标签: amazon-web-services amazon-s3 emr amazon-emr