简体   繁体   English

允许第三方应用程序写入您的 aws 存储桶

[英]allowing a third party application to write to your aws bucket

I have a bit of a problem, to which Iam not sure I know the answer to.我有一个问题,我不确定我是否知道答案。 I have a bucket named staging and I would like to give access to a third party dev (which is building the webapp) to allow file uploads into this bucket.我有一个名为staging的存储桶,我想授予第三方开发人员(正在构建 webapp)的访问权限,以允许将文件上传到该存储桶中。

What is the correct way to go about doing this?这样做的正确方法是什么? Surely, not giving away my aws secrets?当然,不会泄露我的 aws 秘密?

Would be great if someone can point me in the right direction for this.如果有人能为此指出正确的方向,那就太好了。

You can achieve it using Resource Based Policies in Staging S3 bucket.您可以使用Staging S3 存储桶中的Resource Based Policies来实现它。

  1. Add a Resource Based Policy to Staging bucket that allow access to Dev account's IAM User/Role.将基于资源的策略添加到暂存存储桶,以允许访问开发账户的 IAM 用户/角色。

     { "Version": "2012-10-17", "Statement": [{ "Sid": "VisualEditor0", "Effect": "Allow", "Principal": { "AWS": "<ARN of IAM User/Role from Dev Account>" }, "Action": [ "s3:GetObject", "s3:PutObject" ] "Resource": "arn:aws:s3:::staging-bucket/*" }] }
  2. Next, add an IAM Policy in Dev account, that allow access to S3 bucket in Staging account.接下来,在 Dev 帐户中添加一个 IAM 策略,允许访问 Staging 帐户中的 S3 存储桶。

     { "Version": "2012-10-17", "Statement": [{ "Sid": "VisualEditor1", "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject" ] "Resource": "arn:aws:s3:::staging-bucket/*" }] }

References参考

if you are talking about a third party app is uploading content;如果您谈论的是第三方应用程序正在上传内容; one option is You can expose an API via apigateway to upload content to the bucket.一种选择是您可以通过 apigateway 公开 API 以将内容上传到存储桶。 Remember to remove public access from the bucket permission.请记住从存储桶权限中删除公共访问权限。

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

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