# Cloudfront auth lambda

## Purpose

The primary purpose of this lambda function is to provide a way to authorize the access to the 
cloudfront distribution using the [AtlasUM](https://github.com/theorchard/atlas-um) authorization
service.

## Configuration

As for now Cloudfront Lambda@dge does not support the environment variables,
the config it stored inside the lambda code itself.
Avoid to put anything sensitive there. 

## Development

to install the requirements run the following: 
```shell
npm install
```

## Deployment

Lambda@Edge functions have very tight limitations for the deployment, e.g. the package size should not
exceed the 1MB, so the deployment should be configured via the zip package, and the requirements should 
be as thin as possible.
The workflow for the package preparation looks like the following:
- clone the repo
- run `npm install`
- archive needed `index.js` and `node_modules` into zip archive
- deploy to AWS
