downer
downer

Reputation: 964

Sub-folders of a Static Website on S3 and Route 53

I recently started setting up a simple static website on AWS using S3 and Route 53. There are a number of tutorials for doing the basic parts, and there isn't that much complexity anyway. I'm able to view the main page (index.html) just fine; I just point the browser to mypage.com and I'm in business. However, I want to have a little bit of nested structure.

In my mypage.com aws bucket, I have a folder, mypage.com/music. Entering that url in the browser results in:

Code: NoSuchKey
Message: The specified key does not exist.

When what I'd expect is a simple folder view of the contents of that directory. How do I make this happen?

Upvotes: 1

Views: 537

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179084

S3 doesn't generate folder views of what's in a bucket (except of course in the AWS console, but the directory listing shown there is not rendered by S3 -- it's rendered by the AWS console).

The NoSuchKey error refers to the fact that there is no object at music/index.html.

You would need to render your own directory listing as a static HTML file and save it as music/index.html or use the S3 SDK in a CloudFront/Lambda@Edge function to fetch the listing from the service and render a response.

Upvotes: 1

Related Questions