AWS S3 Bucket Browser
Base on the idea of : https://github.com/rgrp/s3-bucket-listing and inspired on the current S3 Browser from Amazon.
Intent for public or private usage, you can deploy this files on any web site.
Not intent for deploy on your own bucket (for me no make sense).
Using the new IAM Users from AWS you can provide more specific and secure access to your buckets.
Notes I recommend create specific user or roles to access bucket to browse, then generate their access key, for now this code is intent only for browse, then no need to create a user with other privileges just use ListObjects. Check this link http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
Copy the files on your web site. Could be based on Apache or IIS.
Modify the setting in file js/config.js
- var AWS_AccessKeyId = ''; //Your credentials for specific user and privileges
- var AWS_SecretAccessKey = ''; //Your credentials for specific user and privileges
- var AWS_Region = 'us-east-1';
- var AWS_BucketName = '';
- var AWS_MaxKeys = 500; //How many objects will retrive (include folders and items)
- var AWS_Prefix = ''; //Stating folder, by default start on root of bucket
- var TITLE = 'S3 Bucket browser';
Notes: You can leave the
SecretAccessKeyas empty strings to avoid exposing AWS credentials publicly. In this case the S3 Bucket Browser will prompt user for credentials via WEB form.
Navigate to index.html and start browsing...
Need to establish this CORS configurations on your bucket to works correctly:
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>DELETE</AllowedMethod> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>
Copyright and License
Copyright 2017 Juvenal Guzman.
Special thanks to:
Joseph Chereshnovsky (webdevbyjoss) Jouni Kaplas (kaplas)
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.