A serverless image processing application built on AWS using Terraform. The system allows authenticated users to upload images through a web interface, stores them in Amazon S3 using presigned URLs, processes upload events asynchronously through Amazon SQS and AWS Lambda, stores image metadata in Amazon DynamoDB, and sends processing notifications using Amazon SNS.
Frontend (HTML / JavaScript)
│
▼
CloudFront
│
▼
API Gateway (HTTP API)
│
▼
API Lambda
│
▼
Presigned S3 Upload URL
│
▼
Amazon S3
│
▼
S3 Event Notification
│
▼
Amazon SQS
│
▼
Processor Lambda
│
┌──────┴──────┐
▼ ▼
DynamoDB SNS
- Amazon Cognito User Pool
- Cognito Hosted UI
- OAuth 2.0 Authorization Code Flow
- JWT-based API authorization
- User-specific image ownership enforcement
- Secure direct browser uploads using presigned S3 URLs
- No image data passes through API Gateway or Lambda
- Upload progress and preview support
- S3 ObjectCreated events trigger processing workflow
- SQS decouples storage and processing layers
- Processor Lambda extracts metadata
- DynamoDB updated after successful processing
-
Stores:
- Image ID
- User ID
- Filename
- Content Type
- Extension
- File Size
- Processing Status
- Created Timestamp
- Processed Timestamp
- SNS notifications sent when processing completes successfully
- Cognito login/logout
- Upload image preview
- Image listing dashboard
- Image metadata viewer
- Full image preview modal
| Service | Purpose |
|---|---|
| Amazon Cognito | Authentication and user management |
| API Gateway HTTP API | REST API |
| AWS Lambda | Business logic and processing |
| Amazon S3 | Image storage |
| Amazon DynamoDB | Metadata storage |
| Amazon SQS | Event buffering |
| Amazon SNS | Notifications |
| Amazon CloudFront | Frontend hosting |
| Terraform | Infrastructure as Code |
POST /images
Authorization: Bearer <token>{
"filename": "example.jpg",
"contentType": "image/jpeg"
}{
"imageId": "uuid",
"uploadUrl": "presigned-url"
}GET /images
Authorization: Bearer <token>{
"images": [
{
"imageId": "uuid",
"filename": "example.jpg",
"status": "COMPLETED",
"createdAt": "2026-06-19T05:57:17.598344+00:00"
}
]
}GET /images/{imageId}
Authorization: Bearer <token>{
"image": {
"imageId": "uuid",
"filename": "example.jpg",
"contentType": "image/jpeg",
"extension": "jpg",
"fileSize": 29222,
"status": "COMPLETED",
"createdAt": "2026-06-19T05:57:17.598344+00:00",
"processedAt": "2026-06-19T05:57:30.326139+00:00"
},
"downloadUrl": "presigned-url"
}ImageMetadata
userId
imageId
CreatedAtIndex
Partition Key: userId
Sort Key: createdAt
uploads/
└── {userId}/
└── {imageId}/
└── {filename}
Example:
uploads/
└── 2478c428-0091-70f3-8115-6ebfb24685e8/
└── 92e0e3c9-a32c-41de-ac6d-7c67668e89c6/
└── image.jpg
- User authenticates through Cognito.
- Frontend requests upload URL from API Gateway.
- API Lambda creates metadata record in DynamoDB.
- API Lambda returns presigned S3 upload URL.
- Browser uploads image directly to S3.
- S3 generates ObjectCreated event.
- Event is sent to SQS.
- Processor Lambda consumes SQS message.
- Lambda retrieves image metadata from S3.
- DynamoDB record updated with processing details.
- SNS notification published.
- Image appears as COMPLETED in frontend.
- Image selection
- Local image preview
- Upload status indicator
- List uploaded images
- Display processing status
- Refresh image list
- Full image preview
- Metadata display
- Processing information
- Logged In indicator
- Logged Out indicator
Initialize Terraform:
terraform initReview changes:
terraform planDeploy infrastructure:
terraform applyDestroy infrastructure:
terraform destroy.
├── frontend/
│ ├── index.html
│ ├── scripts.js
│ ├── styles.css
│ └── config.js
│
├── terraform/
│ ├── main.tf
│ ├── variables.tf
│ ├── outputs.tf
│ └── modules/
│
├── lambda/
│ └── image-api/
│ └── lambda_function.py
│
├── processor/
│ └── lambda_function.py
│
└── README.md
- Direct S3 uploads through presigned URLs
- No public bucket access
- JWT-based authorization
- User ownership validation
- IAM least-privilege permissions
- CloudFront HTTPS delivery
- SQS decoupled processing architecture
- Image thumbnail generation
- Multiple image formats
- Image transformations
- Metadata search functionality
- User-specific notifications
- CloudWatch dashboards and alarms
- CI/CD pipeline using AWS SAM or GitHub Actions
Tarun Harish