Skip to content

tsubasaogawa/lambda-image-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lambda-image-viewer

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.

Features

CDN

route: <CDN Domain>/.../foo.jpg

  • Provides a standard S3-backed CDN via CloudFront.
  • Private mode: Images in the private folder are accessible only with the appropriate token query.

Image Viewer

route: <Viewer Domain>/image/.../foo.jpg

image
  • Shows an image info (EXIF).

Camera Roll (Admin Page)

route: <Viewer Domain>/cameraroll/

image
  • You can list all uploaded images.
  • Basic auth.
  • Private images (/private/*.jpg): only accessible from camera roll page.

Structure

Diagram

  • The viewer does not use ALB but Lambda Function URLs.
  • S3-event-driven Tagger gets EXIF by a photo and puts to DynamoDB.

DynamoDB item example

Requirements

  • Serverless Framework v3.34
  • Terraform v1.12 or above
  • Go 1.21
  • AWS

You can also use **env to install easily.

Usage

Clone

git clone https://github.com/tsubasaogawa/lambda-image-viewer.git

Deploy Lambda

cd 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 info

Deploy Infrastructure

cd ../../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 deploy

Upload photo

aws s3 cp <PHOTO FILE> s3://<CREATED S3 BUCKET>/<FILE NAME>

Future Works

  • Fix design

About

Low-cost image viewer, image management web app.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors