cloudfront-private-url-creator
Creates and signs private Cloudfront Urls (http:, https:, rtmp:, rtmpt:, rtmpe:, and rtmpte:
)
Installation:
npm i cloudfront-private-url-creator
Note:
If you are using Node 0.10 - 0.12
, please use version 1.1.0
.
Usage:
'use strict'const fs = const cf = const urlToSign = 'https://somedistro.cloudfront.net/somefolder/someFile'const keyPairId = 'yourKeyPaidId'const privateKeyPath = './yourKey.pem' // date when the private url will expire (1 hour from now in this case)const dateLessThan = dateLessThan const privateKey = fs const config = privateKey keyPairId dateLessThan// sign the url and return it, or just get the signatureconst signatureQueryString = cf// ORconst signedUrl = cf
Relevant AWS docs:
Creating a Signed URL Using a Canned Policy
Creating a Signed URL Using a Custom Policy