AWS Lambda for CloudFront Signed URL Generator
git clone https://github.com/simplydemo/aws-signedurl-lambda.git
cd aws-signedurl-lambda
npm install
npm run build
docker build -t aws-signedurl-lambda:local -f ./cicd/docker/Dockerfile .
docker run --rm --platform linux/arm64 --name aws-signedurl-lambda -p 9000:8080 \
-v ~/.aws/credentials:/root/.aws/credentials \
-e AWS_PROFILE=<AWS_PROFILE> \
-e AWS_REGION=<AWS_REGION> \
-e CLOUDFRONT_DOMAIN=<CLOUDFRONT_DOMAIN> \
-e CLOUDFRONT_KEYPAIR_PATH="<CLOUDFRONT_KEYPAIR_PATH>" \
-e KEY_PAIR_ID="<KEY_PAIR_ID>" \
aws-signedurl-lambda:local
# docker exec -it aws-signedurl-lambda bash
aws-lambda-rie 와 Jest 를 통해 테스트를 진행할 수 있습니다.
curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"s3ObjectPath":"<S3_OBJECT_PATH>","expireDays":"3"}'
jest src/test/handler.test.js