I’ve’ setup an S3 bucket for hosting media related to this blog and since the content of this media is by definition public, I wanted a simple way for everyone to publicly list the content of that directory similar to that of Apache
Setup was simple – make sure you replace media.hatim.eu with
- Created a bucket in eu-west-1 called media.hatim.eu and enabled static website hosting.
- Used the AWS Policy generator to create a bucket policy to allow everyone to run
arn:aws:s3:::media.hatim.eu/*and applied to my bucket.
- Added a simple CORS policy like this:
1 2 3 4 5 6 7
- Added a route53 CNAME record for
- Copied list.js from the github repo into the root of the bucket.
- Created an index.html file and added following code before uploading it to the root of the bucket:
1 2 3 4 5 6 7 8 9 10 11 12 13
Now anyone can just go to media.hatim.eu and see a completely browsable directory structure and be able to find the right asset. This can be really handy if you are using s3 to host binaries or builds that can benefit from being browsable.