- Create an Amazon Web Services (AWS) account.
- Once at the main AWS dashboard search for the
IAMservice or scroll down to find theIAMservice and select that. - On the left panel of the
IAMservice selectUsers. - Click
Add userat the top of the screen. - Enter a
User namein the text field. This can be anything (ex.webuser,s3user,appkey, etc.) - Click the check box next to
Programmatic access. - Click
Next: Permissions. - Select
Attach existing policies directly. - In the search field right below that type in
S3. - Click on the check box next to
AmazonS3FullAccess. - Scroll down and click on the
Next: Tagsbutton. - Skip this screen by pressing
Next: Review(Unless you want to add specific tags for the user) - Click
Create user. - This will display a table with your
Access key IDandSecret access key. You will need to click theShowbutton to view yourSecret access key. Important: this is the only time you will be able to see your secret access key without regenerating it, so please be sure to save it somewhere secure.
- Go to the main AWS dashboard.
- Search for or scroll down to select
S3. - Click
Create bucket. - Give your bucket a unique name. This could be your project name or whatever you want to call it.
- Select the region you wish to store your bucket data in.
- Click
Next. - The next panel "Configure Options" allows you to set custom properties for your bucket. For now we will use the default settings so click
Next. - The next panel "Set Permissions" allows you to set public permissions for your bucket:
- Uncheck: Block new public ACLs and uploading public objects (Recommended)
- Uncheck: Remove public access granted through public ACLs (Recommended)
- Uncheck: Block new public bucket policies (Recommended)
- Uncheck: Block public and cross-account access if bucket has public policies (Recommended)
- Click
Next. - Click
Create bucket.
- After creating an IAM user and S3 bucket, clone this repo to your computer.
- Run
npm installonce in the project directory to install all dependancies required for this project. - Change the
keys.jsfile to include your IAM user keys and the name of your S3 bucket. - Review the code, and implement in your own projects or applications.
- Have fun!!!
- All items you upload/store in the bucket will be public. This is not considered best practice. As this is a basic tutorial it is all that we cover. It would be a good idea to research how to make the items private and have better controls over access to the bucket. Please be mindful of security when building web services.
- The URL to access the objects you upload will be
https://s3-yourawsregioncode-amazonaws.com/YOURS3BUCKETNAME/FILEPATH, see this link for what to put in place ofyourawsregioncode. For example if my S3 bucket was calleds3examplebucket, in the US West (Oregon) region and I had a file in the root directory calledpicture.jpgthe URL to access it would behttps://s3-us-west-2.amazonaws.com/s3examplebucket/picture.jpg - You can use Cyberduck or the AWS Console to view files, delete files, upload files, download files, and much more in your S3 bucket.
- Amazon Web Services S3 is not a free service. Please be aware of all pricing related to this service. As of 08/24/2017 the pricing infomation can be found at this link.
- Contact me with any questions!! You can use my contact page. Feel free to also submit issues or pull requests on GitHub.