A Typescrtipt utility to create an AWS CloudFront Signed Url
This project creates a CloudFront
Signed Url based on a custom policy which allows access to specific files on the CloudFront distribution.
The Policy is generated using a combination of paramteters defined in a .env
file.
The policy expire after a set amount of time and grant access to all files matching a predifined PATTERN
The lifetime of the policy depends on the EXPIRY
Timestamp defined in an environment variable:
Create a .env
file and the below paramters
CF_URL
: The EndpointEXPIRY
: The date and time in a Timestamp format that users can no longer access your contentPATTERN
: Define a custom patternsKEYPAIRID
: Your CloudFront Certificate identifierPRIVATEKEYFILE
: The path to your private key file location
Requirements
- node ~12.21.0
- npm ^6.14.11
Install required dependencies
npm ci
node dist/app.js