无需访问权限即可上传到 Amazon S3密钥 [英] Uploading to Amazon S3 without access & secret key

查看:26
本文介绍了无需访问权限即可上传到 Amazon S3密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常当我上传到 S3 存储时,我使用这样的 AmazonS3Client:

Usually when I upload to S3 storage, I use an AmazonS3Client like this:

var client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey, s3Config)

这适用于内部使用,但现在我正在考虑向外部用户提供一个应用程序并且不希望我们的(秘密)访问 &秘密密钥在那里.我已经使用存储桶策略设置了一个 S3 存储桶,允许来自匿名用户的上传 (PutObject),但我现在如何使用 Amazon SDK?如果不提供访问权限和密钥,我似乎找不到任何方法.

This works fine for internal use but now I am looking at providing an app to external users and don't want our (sacret) access & secret keys to be out there. I've set up an S3 bucket with a bucket policy allowing uploads (PutObject) from anonymous users but how do I use the Amazon SDK now? I can't seem to find any way without providing the access and secret key.

推荐答案

你只需要为 accessKeysecretKey 传递 null 和你可以将 SDK 用于任何允许匿名的操作.

You just need to pass null for accessKey and secretKey and you can use the SDK for any anonymously allowed operation.

查看这个我的相关问题,其中包括亚马逊员工在其开发者论坛上的官方回复!来自链接问题的相关信息:

Check out this related question of mine it includes an official response from an Amazon employee from their developer forum! Relevant information from the linked question:

这是亚马逊官方员工在他们的论坛上写的:

This is from an official Amazon employee on their forum:

从 SDK 1.3.8.0 版本开始,您可以为访问传递 null和密钥,SDK 将跳过签名过程并尝试像 GetObject 这样的操作作为公共操作.

As of the 1.3.8.0 release of the SDK you can pass null for the access and secret key and the SDK will skip the signing process and try the operations like GetObject as a public operation.

规范

这篇关于无需访问权限即可上传到 Amazon S3密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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