Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create an query-string authorized s3 URL?

Apparently s3 supports urls in the form:

http://s3.amazonaws.com/bucket/file.txt?some_kind_of_auth_token

How do I generate a "secure" URL like this?

like image 834
Nathan Manousos Avatar asked Feb 27 '12 19:02

Nathan Manousos


People also ask

What is a query string in URL example?

On the internet, a Query string is the part of a link (otherwise known as a hyperlink or a uniform resource locator, URL for short) which assigns values to specified attributes (known as keys or parameters). In the above example the question mark separates the base URL from the Query strings.

How do I get an S3 signed URL?

Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that contains the object that you want a presigned URL for. In the Objects list, select the object that you want to create a presigned URL for.


Video Answer


1 Answers

This is the official help which covers how to do this.

Look for the section called "Query String Request Authentication Alternative"

GET /photos/puppy.jpg?AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE&
    Signature=rucSbH0yNEcP9oM2XNlouVI3BH4%3D&
    Expires=1175139620 HTTP/1.1

Here's a snip from the help page.

You can authenticate certain types of requests by passing the required information as query-string parameters instead of using the Authorization HTTP header. This is useful for enabling direct third-party browser access to your private Amazon S3 data, without proxying the request. The idea is to construct a "pre-signed" request and encode it as a URL that an end-user's browser can retrieve. Additionally, you can limit a pre-signed request by specifying an expiration time.

like image 74
101010 Avatar answered Nov 04 '22 22:11

101010