Simple S3-compatible signing of a URL to enable uploads via client-side.
TODO: will integrate in with JWT token permission as a microservice
-
Get your S3 account with the key, secret and bucket
-
Your S3 bucket needs CORS setup with following XML entry:
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin></AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <AllowedHeader></AllowedHeader> </CORSRule> </CORSConfiguration>
$ export AWS_ACCESS_KEY = '[your access key]'
$ export AWS_SECRET_KEY = '[your secret]'
$ export S3_BUCKET = '[your bucket]'
(optional but defaults to)
$ export S3_HOSTNAME = 's3.amazonaws.com'
$ node index.js