Search code examples
amazon-web-servicesamazon-s3

How to Secure amazon s3 bucket web URL of a resource against unauthorised user


I am totally new to s3 bucket, I know we can save images, videos, etc any kind of resources there. when I want to access these images from my app I can access through web url but how to make sure any other unauthorised user can't see/download my image using that url(URL is so easy to guess if bucket name is known).

How to make the URL secure?

Can I use my preferred username & password into the URL to make it secure?

I also do not found any way to make the resources unaccessible through the URL that amazon uses(http://s3.amazonaws.com/bucketname/resourcename.extension), is that possible?

Any help would be appreciated... Thanks.


Solution

  • First, make your bucket private.

    Then, generate signed URL to access your content.

    The format will be https://<bucket>.s3.amazonaws.com/objectname?AWSAccessKeyId=<accesskey>&Expires=<expiretime>&Signature=<signature string>

    Please see https://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html

    You can also try it with this tool: http://www.dancartoon.com/projects/s3-siggenerator/