Nik
Nik

Reputation: 2726

Cannot seem to write to S3 bucket set up as website

I'm trying to do the following scenario:

bucket set up called share.example.com.

My website will be writing to this bucket - dynamically (User generated content).

I want the bucket to be a website, with index.html as the default document.

So a user does something on my site, app then writes to

share.example.com/foo/bar1/index.html

I then want the user to be able to browse to

http://share.example/foo/bar1/ (<-- note, no index.html)

I thought this would be trivial:

However, a problem.

In the above configuration, when I try the write, I get a 405. If I change the CNAME to point to share.example.com.s3.amazonaws.com, the write succeeds, but now the website won't work as required.

What is the solution here?

Thanks a stack for any help.

Upvotes: 1

Views: 134

Answers (1)

Nik
Nik

Reputation: 2726

The trick was to not use the vanity domain for the writing aspect.

I.e. instead of trying to do the PUT to share.example.com/foo/bar1, do it to s3.amazonaws.com/share.example.com/foo/bar1

The CNAME to share.example.com can then point to share.example.com.s3-website-us-east-1.amazonaws.com and it all works.

Upvotes: 1

Related Questions