Posts

Showing posts with the label s3

Implementing Image Transformation Service with NextJS and imgproxy

Image
Introduction imgproxy is an efficient image processing and optimization service, featuring fast processing speeds, high security and low memory footprints because it is written in Go. The prominent advantages of imgproxy include the ability to resize, crop, compress and flexibly convert image formats (such as to WebP, AVIF) via URL. Notably, this service supports secure URL signing using HMAC encryption, which prevents DDoS attacks or unauthorized modifications of image size parameters from the client side. Although the NextJS Image component already supports automatic image resizing, it presents several limitations if you choose it for large-scale deployment Resized images stored in the cache of the .next folder only exist within a single NextJS server instance, making it difficult to share the cache when scaling up to multiple instances After building the project, the cache data is lost, or if you find a way to persist these resized images, a large dataset will still consume too much...

Deploy docker image to AWS Lambda

Image
Introduction In my previous article, I provided instructions on using lambda to implement a function to resize images on demand; now, I will provide instructions on deploying a docker image to lambda. The advantage of using Lambda is pay on demand, suitable for types of projects newly released in the early stages when there are not yet many uses; deployment with Lambda helps simplify the process for the dev team to focus on feature development; resource management will be managed by AWS, and will automatically scale according to user usage needs. Detail Using AWS CDK, create the file lib/deploy-lambda-stack.ts import * as cdk from "aws-cdk-lib" import * as ecr from "aws-cdk-lib/aws-ecr" import * as iam from "aws-cdk-lib/aws-iam" import * as lambda from "aws-cdk-lib/aws-lambda" import { Construct } from "constructs" export class DeployLambdaStack extends cdk . Stack { constructor ( scope : Construct , id : ...