A simple image viewer using AWS Lambda + CloudFront + DynamoDB + S3.
I used to use Flickr as a storage for blog images, but for several reasons (mainly financial), I needed an alternative. Therefore, I am prioritizing the implementation of features that are essential for my personal use.
route: <CDN Domain>/.../foo.jpg
- Provides a standard S3-backed CDN via CloudFront.
- Private mode: Images in the
privatefolder are accessible only with the appropriate token query.
route: <Viewer Domain>/image/.../foo.jpg
- Shows an image info (EXIF).
route: <Viewer Domain>/cameraroll/
- You can list all uploaded images.
- Basic auth.
- Private images (
/private/*.jpg): only accessible from camera roll page.
- The viewer does not use ALB but Lambda Function URLs.
- S3-event-driven Tagger gets EXIF by a photo and puts to DynamoDB.
- Serverless Framework v3.34
- Terraform v1.12 or above
- Go 1.21
- AWS
You can also use **env to install easily.
git clone https://github.com/tsubasaogawa/lambda-image-viewer.gitcd src/viewer
# Fix environments. Please follow comments in .env file.
cp -p .env.tmpl .env
vim .env
# Building go binary, deploying lambda
serverless deploy
# Show the deploy information.
serverless infocd ../../terraform
# Fix environments.
cp -p terraform.tfvars.tmpl terraform.tfvars
vim terraform.tfvars
terraform init
terraform apply
# Deploy Lambda again to set some environment variables using Secrets Manager created by Terraform.
cd ../src/viewer
serverless deployaws s3 cp <PHOTO FILE> s3://<CREATED S3 BUCKET>/<FILE NAME>- Fix design

