AWS CLI 使用多个凭证同步 S3 存储桶 [英] AWS CLI syncing S3 buckets with multiple credentials

查看:44
本文介绍了AWS CLI 使用多个凭证同步 S3 存储桶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拥有对源 S3 存储桶的只读访问权限.我无法更改此源帐户和存储桶的权限或任何类型的内容.我不拥有此帐户.

I have read-only access to a source S3 bucket. I cannot change permissions or anything of the sort on this source account and bucket. I do not own this account.

我想将源存储桶中的所有文件同步到目标存储桶.我拥有包含目标存储桶的帐户.

I would like to sync all files from the source bucket to my destination bucket. I own the account that contains the destination bucket.

对于我不拥有的源存储桶和我拥有的目标存储桶,我有一组单独的凭据.

I have a separate sets of credentials for the source bucket that I do not own and the destination bucket that I do own.

有没有办法使用 AWS CLI 使用两组凭证在存储桶之间进行同步?

Is there a way to use the AWS CLI to sync between buckets using two sets of credentials?

aws s3 sync s3://source-bucket/ --profile source-profile s3://destination-bucket --profile default

如果没有,我如何在我拥有的目标存储桶上设置可以与 CLI 同步的权限?

If not, how can I setup permissions on my owned destination bucket to that I can sync with the CLI?

推荐答案

内置的 S3 复制机制,在 API 级别,要求将请求提交目标存储桶,识别源请求中的存储桶和对象,并使用单组凭据,这些凭据既有权从源读取,也有权写入目标.

The built-in S3 copy mechanism, at the API level, requires the request be submitted to the target bucket, identifying the source bucket and object inside the request, and using a single set of credentials that has both authorization to read from the source and write to the target.

这是从一个存储桶复制到另一个存储桶而无需下载和上传文件的唯一支持方式.

This is the only supported way to copy from one bucket to another without downloading and uploading the files.

标准解决方案位于 http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example2.html.

您可以授予他们的用户写入您的存储桶的权限,或者他们可以授予您的用户访问其存储桶的权限……但是,如果没有两个帐户所有者的共谋,就不可能在不下载和重新上传文件的情况下从一个存储桶复制到另一个存储桶建立一组具有这两种权限的凭据.

You can grant their user access to write your bucket or they can grant your user access to their bucket... but copying from one bucket to another without downloading and re-uploading the files is impossible without the complicity of both account owners to establish a single set of credentials with both privileges.

这篇关于AWS CLI 使用多个凭证同步 S3 存储桶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆