10

I have a static HTML site hosted on Amazon S3.

Ideally I want to be able to limit access to a staging site in the same way as with a .htaccess/.htpasswd file.

I understand that bucket policies can be used to limit access (I have already used one to make the bucket contents publicly accessible), but I can't see any way to limit access.

In an ideal situation I would like an auth prompt - but appending a token to a URL would also work.

Leon Barrett
  • 111
  • 1
  • 5
  • Possible duplicate of [Does Amazon S3 support HTTP request with basic authentication](http://stackoverflow.com/questions/3091084/does-amazon-s3-support-http-request-with-basic-authentication) – TomDotTom May 31 '16 at 18:35
  • I would take a look at the answer on this SO post http://stackoverflow.com/a/37553174/2398354 – TomDotTom May 31 '16 at 18:36

4 Answers4

5

Yes, this is possible: checkout s3auth (no affiliation).

J0hnG4lt
  • 4,337
  • 5
  • 24
  • 40
2

I think the AWS SDK for Javascript is what you're looking for. It allows you to login with Facebook, Google or Amazon. Here's another resource using AWS login.

Ryan Shillington
  • 23,006
  • 14
  • 93
  • 108
0

Could you use the standard AWS token keys for auth? You would need some JavaScript or similar to apply the key to all assets/internal links within the page which introduces a slight delay to loading but it should work in theory.

Dachande663
  • 504
  • 1
  • 6
  • 16
0

You can try manipulating the AWS ACL, but otherwise, you will need to clone it to a repo on a private server or something. From reading the description, it seems like S3's ability to serve static pages is pretty limited and is designed more as a convenience then a functional server.

Kyros
  • 512
  • 2
  • 5