Getting a pre-authenticated URL to an S3 bucket

为君一笑 提交于 2019-12-22 09:35:35

问题


I am attempting to use an S3 bucket as a deployment location for an internal, auto-updating application's files. It would be the location where the new version's files are dumped for the application to puck up on an update. Since this is an internal application, I was hoping to have the URL be private, but to be able to access it using only a URL. I was hoping to look into using third party auto updating software, which means I can't use the Amazon API to access it.

Does anyone know a way to get a URL to a private bucket on S3?


回答1:


You probably want to use one of the available AWS Software Development Kits (SDKs), which all implement the respective methods to generate these URLs by means of the GetPreSignedURL() method (e.g. Java: generatePresignedUrl(), C#: GetPreSignedURL()):

The GetPreSignedURL operations creates a signed http request. Query string authentication is useful for giving HTTP or browser access to resources that would normally require authentication. When using query string authentication, you create a query, specify an expiration time for the query, sign it with your signature, place the data in an HTTP request, and distribute the request to a user or embed the request in a web page. A PreSigned URL can be generated for GET, PUT and HEAD operations on your bucket, keys, and versions.

There are a couple of related questions already and e.g. Why is my S3 pre-signed request invalid when I set a response header override that contains a “+”? contains a working sample in C# (aside from the content type issue Ragesh is experiencing of course).

Good luck!



来源:https://stackoverflow.com/questions/9098474/getting-a-pre-authenticated-url-to-an-s3-bucket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!