Skip to content

πŸ” Secure, serverless photo download system using AWS Cognito authentication, Lambda functions, and private S3 storage with time-limited access links

License

Notifications You must be signed in to change notification settings

AKRAMSOUIDA/Secure-Photo-Downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Secure Photo Downloader - AWS Serverless Authentication System

A secure, serverless photo download system using AWS Cognito authentication and S3 storage. Users authenticate through Cognito Hosted UI and receive secure, time-limited download links for their photos.

πŸ—οΈ Architecture

System Overview

User β†’ Cognito Hosted UI β†’ Lambda Function β†’ S3 Pre-signed URL β†’ Secure Download

Visual Architecture

Main Architecture

Complete system architecture showing all AWS components and data flow. View all diagrams β†’

πŸ”§ Components

  • AWS Cognito User Pool: User authentication and management
  • AWS Cognito Identity Pool: AWS credentials for authenticated users
  • AWS Lambda: Generates secure download links
  • AWS S3: Secure photo storage with private access
  • AWS IAM: Fine-grained permissions and security policies

πŸš€ Features

  • βœ… Secure user authentication via Cognito Hosted UI
  • βœ… Time-limited download links (configurable expiry)
  • βœ… Private S3 bucket with zero public access
  • βœ… Fully serverless architecture (no servers to manage)
  • βœ… User-friendly download interface
  • βœ… Comprehensive error handling and logging
  • βœ… Cost-effective pay-per-use model

πŸ“‹ Prerequisites

  • AWS Account with appropriate permissions
  • AWS CLI configured with valid credentials
  • Basic understanding of AWS serverless services

πŸ› οΈ Quick Deployment

  1. Clone this repository

    git clone <this-repo-url>
    cd secure-photo-downloader
  2. Configure your settings

    # Edit the configuration in scripts/deploy.sh
    # Set your email and preferred AWS region
  3. Run the deployment script

    chmod +x scripts/deploy.sh
    ./scripts/deploy.sh
  4. Upload your photos to S3

    aws s3 cp your-photos.zip s3://YOUR-BUCKET-NAME/photos/photos.zip
  5. Get your authentication URL

    ./scripts/get-auth-url.sh

πŸ“– Detailed Setup Guide

See DEPLOYMENT.md for comprehensive deployment instructions and troubleshooting.

πŸ”’ Security Features

  • Zero Trust Architecture: All S3 objects are private by default
  • Time-Limited Access: Download links expire automatically (default: 1 hour)
  • Authenticated Access Only: Only verified users can access downloads
  • Least Privilege IAM: Roles follow security best practices
  • Encrypted Storage: S3 server-side encryption enabled
  • Audit Trail: CloudWatch logging for all access attempts

πŸ§ͺ Testing Your Deployment

  1. Visit your Cognito Hosted UI URL (provided after deployment)
  2. Sign up or sign in with your credentials
  3. Complete email verification if required
  4. You'll be redirected to the secure download page
  5. Your photo download will begin automatically

πŸ“ Project Structure

secure-photo-downloader/
β”œβ”€β”€ README.md                    # Project overview and quick start
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ DEPLOYMENT.md           # Detailed deployment guide
β”‚   β”œβ”€β”€ ARCHITECTURE.md         # System architecture and design
β”‚   └── DIAGRAMS.md             # Architecture diagrams documentation
β”œβ”€β”€ diagrams/                   # Generated architecture diagrams
β”‚   β”œβ”€β”€ main_architecture.png   # Overall system architecture
β”‚   β”œβ”€β”€ security_architecture.png # Security layers and controls
β”‚   β”œβ”€β”€ data_flow.png           # Step-by-step process flow
β”‚   β”œβ”€β”€ deployment_architecture.png # Infrastructure deployment
β”‚   └── cost_optimization.png   # Cost management strategies
β”œβ”€β”€ lambda/
β”‚   β”œβ”€β”€ auth-handler.py         # Lambda function for authentication
β”‚   └── requirements.txt        # Python dependencies
β”œβ”€β”€ cloudformation/
β”‚   β”œβ”€β”€ auth-stack.yaml         # Cognito authentication resources
β”‚   β”œβ”€β”€ storage-stack.yaml      # S3 bucket and security policies
β”‚   └── compute-stack.yaml      # Lambda function and IAM roles
β”œβ”€β”€ scripts/
   β”œβ”€β”€ deploy.sh               # Main deployment automation
   β”œβ”€β”€ cleanup.sh              # Resource cleanup script
   └── get-auth-url.sh         # Retrieve authentication URL

βš™οΈ Configuration Options

The system supports various configuration options:

  • Download Expiry: Configure link expiration time
  • File Types: Support for various photo formats and archives
  • User Management: Customize user pool settings
  • Regional Deployment: Deploy to any AWS region
  • Custom Domains: Optional custom domain configuration

πŸ’° Cost Optimization

This serverless architecture is designed for cost efficiency:

  • Pay-per-use: Only pay when users download photos
  • No idle costs: No servers running 24/7
  • S3 Intelligent Tiering: Automatic cost optimization for storage
  • Lambda efficiency: Optimized function execution time

πŸ”§ Customization

Easy to customize for your specific needs:

  • Branding: Update UI colors and logos
  • File Types: Support different file formats
  • User Flows: Modify authentication workflows
  • Notifications: Add email/SMS notifications
  • Analytics: Integrate with AWS analytics services

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support & Troubleshooting

If you encounter issues:

  1. Check the troubleshooting guide
  2. Review CloudWatch logs for the Lambda function
  3. Verify your AWS permissions and quotas
  4. Open an issue with detailed error information

🏷️ Version

Current version: 1.0.0

🌟 Use Cases

Perfect for:

  • Event Photography: Secure photo distribution for weddings, parties
  • Corporate Events: Professional photo sharing with access control
  • Family Sharing: Private photo albums with time-limited access
  • Client Deliverables: Secure file delivery for creative professionals
  • Educational Content: Controlled access to course materials

Built for secure, scalable photo sharing

About

πŸ” Secure, serverless photo download system using AWS Cognito authentication, Lambda functions, and private S3 storage with time-limited access links

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published