Coder Social home page Coder Social logo

optimized-image-delivery's Introduction

Optimized Image Delivery

This is the implementation of the Optimized Image Delivery blog post written by the Caylent team.

The architecture is as follows:

Architecture Diagram

After the pre-requisites are taken care of, you can deploy the stack by running:

npx cdk deploy

Pre-requisites

  • Ensure the following environment variables are set:
    • CDK_DEFAULT_ACCOUNT -> AWS Account ID
    • CDK_DEFAULT_REGION -> AWS Region
    • APEX_DOMAIN -> The root domain name you want to set in the CloudFront distribution, for example: example.com
    • SUBDOMAIN -> The subdomain you want to set in the CloudFront distribution, for example: www
    • STACK_ID -> A unique identifier for the stack, for example: main or dev
  • AWS CDK version 2.90.0 or higher.
  • Node.js version 18.
  • Docker version 24.0.5 or higher.

How to use it?

After the stack is deployed, you can upload images to the S3 bucket created by the stack. The images will be automatically resized and optimized by the Lambda function and stored in the same bucket.

You can access the images by going to the CloudFront distribution URL, for example: https://www.example.com/image.jpg.

And the same image but resized by going to the CloudFront distribution URL but with a query parameter naming the desired transformation, for example: https://www.example.com/image.jpg?transformation-template=webp-20230802-920.

optimized-image-delivery's People

Contributors

cespin avatar

Watchers

Randall Hunt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.