I used aws-cloudfront-sign to sign the S3 url for distributing private content. My code:
var moment = require('moment');
var cf = require('aws-cloudfront-sign');
var options = {
keypairId: 'APxxxxxxxxxxxxxyyyyy',
privateKeyPath: '/path/to/pem/private/file',
expireTime: moment().add(30, 'seconds') //available in 30s
}
var signedUrl = cf.getSignedUrl('http://xxxxxxx.cloudfront.net/path/to/s3/object', options);
console.log('signed url: ' + signedUrl);
I can receive the signed url, and open it in browser.
Problem: after 30s as I assigned, the signed url link is still available, not expired.
Any suggestion is appreciated