Serverless Image Processing with AWS SAM: Uploads, Thumbnails & S3 Events

This example demonstrates a robust serverless architecture on AWS for handling file uploads and automated thumbnail generation. It leverages AWS SAM (Serverless Application Model), Lambda functions, API Gateway, and S3 event notifications to create a streamlined and scalable image processing pipeline. Project Structure Here’s a quick overview of the project’s key components: functions/: Contains the core Lambda function code: event.mjs: Handles S3 event notifications, triggering the thumbnail generation process. upload.mjs: Manages the initial file upload through API Gateway. layers/nodejs/: A Lambda layer containing shared code and dependencies for the functions: lib/utils.mjs: Common utility functions. package.json & package-lock.json: Node.js dependencies for the layer. template.yaml: The AWS SAM template defining the serverless resources: Lambda functions, API Gateway endpoints, S3 buckets, and their respective permissions and event triggers. How It Works The workflow is straightforward and efficient: ...

Host Static Website on AWS with Terraform, S3, and CloudFront

This example outlines a method for deploying static websites on Amazon Web Services (AWS) using Terraform for infrastructure as code, Amazon S3 for content storage, and Amazon CloudFront for global content delivery. The deployment process is fully automated. Project Structure Below is an overview of the project’s key directories and files: public/: Contains the static website assets, such as index.html and 404.html. These are the files that will be served to users. terraform/: This directory holds all the Terraform configuration files (.tf) responsible for provisioning and managing AWS resources. main.tf: Defines the core AWS resources, including the S3 bucket and CloudFront distribution. variables.tf: Contains input variables to parameterize the Terraform configuration (e.g., bucket names, domain names). outputs.tf: Specifies output values that are useful after Terraform applies the configuration, such as the CloudFront distribution domain name. deploy.sh: A shell script to execute the Terraform plan and apply the infrastructure, including uploading static files to S3. destroy.sh: A shell script to tear down all provisioned AWS resources. Project Repository: https://github.com/OmarMakled/aws-terraform-s3 ...