上传到Amazon S3无法获得和放大器;密钥密钥、放大器、Amazon

2023-09-11 09:20:14 作者:遇你

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

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

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

这工作正常供内部使用,但现在我期待在提供应用程序给外部用户,不希望我们(sacret)接入和放大器;密钥到这里来了。我已经成立了一个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的键,您可以使用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:

随着1.3.8.0版本的SDK,你可以通过在访问空   和密钥和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.

规范