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

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

问题描述

通常,当我上载到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.

推荐答案

您只需要为 accessKey secretKey 传递 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:

这是来自论坛上正式的Amazon员工的信息:

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& amp;密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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