Giter VIP home page Giter VIP logo

s3index's Introduction

S3 Index

A simple script which will produce nice looking S3 bucket content listings much in the way you get with most webservers.

Prerequisite

This functionality depends on the s3:ListBucket action for the targetted bucket. If the script is not hosted in the bucket itself you also need to set up a proper CORS configuration for the bucket.

The easiest way is to simply give Everyone the List Objects option is the Access Control List. But a similar more finegrained solution is possible by using a bucket policy. For example:

{
    "Statement": [
        {
            "Action": [
                "s3:GetObject"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::BUCKET/*",
            "Principal": "*"
        },
        {
            "Action": [
                "s3:ListBucket"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::BUCKET",
            "Condition": {
                "StringLike": {
                    "s3:prefix": "FOOBAR/*"
                }
            },
            "Principal": "*"
        }
    ]
}

This would only allow listing of the contents of the FOOBAR directory of the bucket. The root bucket URL would then simply respond with a Access Denied. The standard index.html request would fail to list a bucket, but using index.html#FOOBAR/ would list the contens of the FOOBAR directory.

Installation

Just drop the index.html in your S3 bucket and it should work automatically when opening the page. If you place it in a sub-directory it will automatically list the contents of that directory.

Alternatively you can put it anywhere where and specify the URL parameter ?bucket= with the bucket URL, or edit the HTML and change the config object at the end.

The directory which is listed is provided in the hash part of the URL, or specified as the root field in the config object in the script.

Example

Example

s3index's People

Contributors

elmuerte avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.