Designing your own Cloudinary - Let's Go
Blog
Image Optimization using Amazon CloudFront and AWS Lambda.
๐๐๐๐ก ๐๐ญ๐๐๐ค๐ฌ ๐ฅ :
1. AWS CloudFront
2. AWS S3
3. AWS Lambda
4. CloudFront Functions
๐๐ฑ๐ฉ๐ฅ๐๐ข๐ง๐ข๐ง๐ ๐๐ซ๐๐ก๐ข๐ญ๐๐๐ญ๐ฎ๐ซ๐:
1. The user sends a HTTP request for an image with specific transformations, such as encoding and size. For ex: https://lnkd.in/gbsRSvwv
2. The request is processed by a nearby CloudFront edge location providing the best performance. Before passing the request upstream, a CloudFront Function is executed on viewer request event to rewrite the request URL.
3. If the requested image is already cached in CloudFront then there will be a cache hit and the image is returned from CloudFront cache.
4. If the Image is not in CloudFront cache, then the request will be forwarded to an S3 bucket, which is created to store the transformed images. If the requested image is already transformed and stored in S3, then it is simply served and cached in CloudFront.
5. Otherwise, S3 will respond with a 403 error code, which is detected by CloudFrontโs Origin Failover. CloudFront retries the same URL but this time using the secondary origin based on Lambda function URL. When invoked, the Lambda function downloads the original image from another S3 bucket, where original images are stored, transforms it using Sharp library, stores the transformed image in S3, then serve it through CloudFront where it will be cached for future requests.
๐๐จ๐๐ก, ๐๐ ๐ฃ๐ฎ๐ฌ๐ญ ๐๐ข๐ง๐ข๐ฌ๐ก๐๐ ๐ญ๐ก๐ ๐๐๐ฌ๐ข๐ ๐ง๐ข๐ง๐ ๐ญ๐ก๐ ๐๐ฅ๐จ๐ฎ๐๐ข๐ง๐๐ซ๐ฒ! ๐๐๐๐ก, ๐ข๐ญ ๐ฐ๐๐ฌ ๐๐๐ฌ๐ฒ ๐๐จ๐๐ฌ๐ง'๐ญ ๐ข๐ญ ๐.
๐๐๐ซ๐'๐ฌ ๐ ๐๐ฎ๐ฅ๐ฅ ๐๐ฅ๐จ๐ ๐ข๐ง ๐๐๐ญ๐๐ข๐ฅ: https://aws.amazon.com/blogs/networking-and-content-delivery/image-optimization-using-amazon-cloudfront-and-aws-lambda/
Copyright ยฉ2024 Preplaced.in
Preplaced Education Private Limited
Ibblur Village, Bangalore - 560103
GSTIN- 29AAKCP9555E1ZV