Local Setup
- npm install aws-sdk
- create a .aws/credentails file in the ${user_home} directory ( True for both MAC, LInux and Windows )
- Copy the below contents to the ${user_home}/.aws/credentials file:
AWSAccessKeyId=agahaha
AWSSecretKey=ahahahae
AWSSecretKey=ahahahae
Also create .aws/config file and add the following two lines:
[default]
region = us-west-2
How to work with pre-signed URLs
Bucket name: my.test
Region: us-west-2
Region: us-west-2
Content Folder: mycontent
I have tested the above by creating pre-signed URLs for upload content:
My logs:
My logs:
The URL is on bucket = my.test,region = us-west-2 is = https://s3-us-west-2.amazonaws.com/my.test/content/hello-upload.txt?AWSAccessKeyId=%22nitesh%22&Content-MD5=lSlzR14%2FTZkv5IV4CGweFw%3D%3D&Expires=1460725754&Signature=bcVxdTE44JkYPFjS77yLn4D2KNw%3D
Success generating pre signed url= https://s3-us-west-2.amazonaws.com/my.test/content/hello-upload.txt?AWSAccessKeyId=%22nitesh%22&Content-MD5=lSlzR14%2FTZkv5IV4CGweFw%3D%3D&Expires=1460725754&Signature=bcVxdTE44JkYPFjS77yLn4D2KNw%3D
Success generating pre signed url= https://s3-us-west-2.amazonaws.com/my.test/content/hello-upload.txt?AWSAccessKeyId=%22nitesh%22&Content-MD5=lSlzR14%2FTZkv5IV4CGweFw%3D%3D&Expires=1460725754&Signature=bcVxdTE44JkYPFjS77yLn4D2KNw%3D
Public and Private Folder for Content on S3
- Log into the AWS console
- Browse to my.test/content/public folder
- Right click and choose 'public'.
- Well that makes it all public.
Set CORS at AWS