LazyMagic

Architecture Overview

This sample system uses AWS Serverless Application Model (SAM) architecture.

If you are familiar with these services, you can skip to the AWS step.

Free Tier

For our sample system, we wanted to demonstrate a low-cost, yet scalable, solution can be hosted by AWS using AWS fully managed services in the Free Tier. The pricing below is as of 10/28/2024.

The AWS Free Tier provides customers the ability to explore and try out AWS services free of charge up to specified limits. For some smaller/low traffic systems, the cost of running the system is negligible. The AWS Free Tier is comprised of three different types of offerings, a 12-month Free Tier, an Always Free Tier, and short-term trials.

  • DynamoDB: Always Free Tier of 25GB of storage, along with 25 provisioned Write and 25 provisioned Read Capacity Units (WCU, RCU) which is enough to handle 200M requests per month.
  • Lambda: Always Free Tier of 1 million free requests per month.
  • SQS: Always Free Tier of 1 million free requests per month.
  • Cognito: Always Free Tier of 50,000 Monthly Active Users.
  • API Gateway: 12-month Free Tier of 1 million API calls monthly.
  • S3: 12-month Free Tier of 5GB.
  • Route53: Always Free 1,000 IP(CIDR) blocks per month. CIDR blocks are not a concern for this architecture.
  • CloudFront: Always Free 1 terabyte data transfer, 10 million HTTP requests, 2 million CloudFront Function invocations, 2 million KeyValueStore reads.

AWS Managed services only charge for what you use. The term AWS uses for this is "scale to zero". All of the services above scale to zero. If you don't use them, you don't incur a cost. From a practical perspective, the S3 service will, after the 12-month Free Tier expires, cost you something. As of 10/21/2024, S3 standard storage costs were $0.023 per GB/month for the first 50 TB/month.

AWS provides a pricing calculator that allows you to explore what your hosting costs will be as you scale up.

DynamoDB Service

DynamoDB is a fully managed NoSQL database service provided by Amazon Web Services (AWS). Here's an overview of its key features:

  • Scalability: Automatically scales to handle massive amounts of data and traffic.
  • Performance: Offers single-digit millisecond latency at any scale.
  • Flexibility: Supports both document and key-value data models.
  • Serverless: No need to manage servers; AWS handles provisioning, patching, and scaling.
  • Availability: Provides built-in high availability and cross-region replication.
  • Security: Offers encryption at rest and in transit.
  • Consistency: Supports both eventual and strong consistency models.
  • Indexing: Allows creation of secondary indexes for flexible querying.
  • Transactions: Supports ACID transactions across multiple items and tables.
  • Time-to-Live (TTL): Automatically deletes expired items.
  • Streams: Captures data modification events in real-time.
  • Encryption at Rest:Stores all data encrypted.

DynamoDB is commonly used for applications that require high scalability and low-latency data access, such as gaming, ad tech, IoT, and session management.

SQS Service

AWS SQS is a serverless message queue service provided by Amazon Web Services (AWS). It allows you to manage messages without provisioning or managing servers, making it easier to build applications that automatically scale.

Key Features:
  • Fully Managed: No infrastructure to manage; AWS handles all the queue management and scaling.
  • Message Types: Supports both Standard queues (at-least-once delivery) and FIFO queues (exactly-once processing).
  • Scalability: Handles any volume of messages without additional configuration.
  • Durability: Messages are stored redundantly across multiple Availability Zones.
  • Security: Integrates with IAM for access control and supports server-side encryption.
  • Visibility Timeout: Prevents multiple consumers from processing the same message simultaneously.
  • Dead-Letter Queues: Helps handle message processing failures and troubleshooting.
Common Use Cases:
  • Decoupling microservices and distributed systems
  • Message buffering between application components
  • Handling high-volume message processing
  • Load leveling and batch processing
  • Fan-out architectures
  • Scheduled task processing
  • Order processing and fulfillment systems
Queue Types:
  • Standard Queues:
    • Unlimited throughput
    • At-least-once delivery
    • Best-effort ordering
  • FIFO Queues:
    • High throughput (up to 3,000 messages per second with batching)
    • Exactly-once processing
    • First-in-first-out delivery
    • Message group support

Lambda Service

AWS Lambda is a serverless compute service provided by Amazon Web Services (AWS). It allows you to run code without provisioning or managing servers, making it easier to build applications that automatically scale.

Key Features:
  • Serverless: No server management required; AWS handles all the infrastructure.
  • Auto-scaling: Automatically scales your application by running code in response to each trigger.
  • Pay-per-use: You're charged only for the compute time you consume.
  • Language Support: Supports multiple programming languages including C#, Node.js, Python, Java, Go, and more.
  • Integration: Seamlessly integrates with other AWS services and can be triggered by various AWS events.
  • Concurrency: Handles concurrent executions, allowing your application to scale instantly when needed.
  • Security: Provides built-in security and isolation.
Common Use Cases:
  • Real-time file processing
  • Real-time stream processing
  • Building serverless backends for web, mobile, IoT, and 3rd party API requests
  • Executing scheduled tasks or jobs
  • Extending other AWS services with custom logic

Cognito Service

Amazon Cognito is a fully managed service that provides authentication, authorization, and user management for web and mobile applications. It enables you to add user sign-up, sign-in, and access control to your apps quickly and easily.

Key Components:
  • User Pools: User directories that provide sign-up and sign-in options for your app users.
  • Identity Pools: Enable you to grant your users access to other AWS services.
Key Features:
  • User Authentication: Supports sign-up and sign-in with username and password, phone number, email, or social identity providers.
  • Security Features: Includes multi-factor authentication (MFA), checks for compromised credentials, account takeover protection, and phone and email verification.
  • Customizable UI: Provides customizable, built-in sign-in and sign-up UI for your apps.
  • Standards Compliance: Supports industry standards like OAuth 2.0, SAML 2.0, and OpenID Connect.
  • Scalability: Automatically scales to handle user growth and large user bases.
  • Data Synchronization: Synchronizes user data and preferences across devices.
  • Integration: Easily integrates with other AWS services and your own backend.
Benefits:
  • Reduced Development Time: Eliminates the need to build, secure, and scale a solution to handle user authentication and management.
  • Enhanced Security: Provides built-in security best practices and features to protect your users and their data.
  • Flexible Authentication: Supports various authentication methods to suit different application needs.
  • Seamless User Experience: Enables consistent authentication across devices and platforms.
  • Cost-Effective: Pay only for active users, with no upfront costs or minimum fees.
Common Use Cases:
  • Adding user authentication to mobile and web applications
  • Managing user profiles and preferences across devices
  • Securing microservices and serverless APIs
  • Implementing social sign-in for applications
  • Enabling secure access to AWS resources for your application users

API Gateway Service

API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. It acts as a "front door" for applications to access data, business logic, or functionality from your backend services.

Key Features:
  • API Management: Create, deploy, and manage APIs for your applications.
  • Security: Protect your APIs using authentication and authorization mechanisms.
  • Traffic Management: Manage traffic with throttling and quota mechanisms.
  • Monitoring: Monitor API usage and performance through detailed metrics and logging.
  • Versioning: Support multiple API versions and stages (e.g., dev, prod).
  • RESTful APIs: Create RESTful APIs using HTTP methods.
  • WebSocket APIs: Build real-time two-way communication applications.
  • Integration: Seamlessly integrate with various AWS services and external HTTP endpoints.
Benefits:
  • Scalability: Handles any number of API calls without manual intervention.
  • Performance: Low latency for API requests and responses.
  • Cost-Effective: Pay only for the API calls you receive and the amount of data transferred out.
  • Easy Monitoring: Access to CloudWatch metrics and logging for comprehensive API insights.
  • Flexible Security Controls: Includes AWS IAM roles and policies, Lambda authorizers, and Amazon Cognito user pools.
Common Use Cases:
  • Building serverless applications with Lambda
  • Exposing functionality from legacy applications
  • Providing a consistent interface for microservices architectures
  • Creating real-time, two-way communication applications
  • Monetizing APIs by metering usage and applying different plans

S3 Service

Amazon S3 (Simple Storage Service) is an object storage service offering industry-leading scalability, data availability, security, and performance. It's designed to store and retrieve any amount of data from anywhere on the web.

Key Features:
  • Durability and Availability: 99.999999999% (11 9's) durability and 99.99% availability of objects over a given year.
  • Scalability: Store and retrieve any amount of data from anywhere.
  • Security: Comprehensive security and compliance capabilities.
  • Performance: Low-latency retrieval of data.
  • Storage Classes: Different storage tiers for various use cases (e.g., S3 Standard, S3 Glacier).
  • Data Management: Lifecycle policies, versioning, and replication features.
  • Query-in-place: Run powerful analytics directly on your data at rest.
Key Concepts:
  • Buckets: Containers for storing objects in S3.
  • Objects: Fundamental entities stored in S3 (files and metadata).
  • Keys: Unique identifiers for objects within a bucket.
  • Regions: Geographic areas where Amazon S3 stores buckets that you create.
Benefits:
  • Cost-effective: Pay only for the storage you use with no minimum fee.
  • Ease of use: Simple web interface and API for easy management.
  • Flexibility: Store any type of data in any format.
  • Wide Integration: Works seamlessly with other AWS services and third-party tools.
  • Compliance: Meets regulatory requirements with various compliance certifications.
Common Use Cases:
  • Backup and storage
  • Content distribution
  • Data lakes and big data analytics
  • Static website hosting
  • Mobile and gaming applications
  • IoT sensor data storage
  • Disaster recovery

CloudFront Service

Amazon CloudFront is a fast content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to customers globally with low latency and high transfer speeds. It integrates with other Amazon Web Services products to give developers and businesses an easy way to accelerate content delivery to end users.

Key Features:
  • Global Network: Utilizes a worldwide network of edge locations for fast content delivery.
  • Security: Provides built-in DDoS protection and integrates with AWS Shield, AWS Web Application Firewall, and Amazon Route 53.
  • Programmable: Supports serverless computing with Lambda@Edge to run custom code closer to users.
  • Deep Integration: Works seamlessly with AWS services like S3, EC2, Elastic Load Balancing, and Amazon Route 53.
  • Real-time Metrics: Offers real-time monitoring and logging capabilities.
  • DevOps Friendly: Supports continuous deployment with AWS CodePipeline and CodeDeploy.
  • Cost-effective: Pay-as-you-go pricing with no upfront fees or long-term commitments.
How It Works:
  1. Users request your content through your website or application.
  2. The request is routed to the nearest CloudFront edge location for best performance.
  3. CloudFront checks its cache for the requested content.
  4. If the content is in the cache, CloudFront returns it to the user.
  5. If the content is not in the cache, CloudFront forwards the request to the specified origin server.
  6. The origin server sends the content back to the CloudFront edge location.
  7. CloudFront caches the content and sends it to the user.
  8. Subsequent requests for the content are served from the CloudFront cache.
Benefits:
  • Improved Performance: Delivers content from edge locations close to users, reducing latency.
  • Enhanced Security: Provides a variety of security features to protect your content and applications.
  • Easy to Use: Simple to set up and manage through the AWS Management Console.
  • Cost Savings: Reduces the load on origin servers, potentially lowering costs.
  • Scalability: Handles traffic spikes and large-scale content delivery without manual intervention.
Common Use Cases:
  • Accelerating static website content delivery
  • Serving on-demand or live streaming video
  • Securely delivering software updates
  • Accelerating dynamic content and API delivery
  • Serving content to global users with consistent performance

Route53 Service

Amazon Route 53 is a highly available and scalable cloud Domain Name System (DNS) web service. It is designed to give developers and businesses an extremely reliable and cost-effective way to route end users to Internet applications by translating names like www.example.com into the numeric IP addresses like 192.0.2.1 that computers use to connect to each other.

Key Features:
  • Domain Registration: Register and manage domain names directly within Route 53.
  • DNS Management: Manage DNS records for your domains.
  • Traffic Flow: Route traffic based on various criteria like latency, geography, and health of your endpoints.
  • Health Checking: Monitor the health and performance of your web applications, web servers, and other resources.
  • DNS Failover: Automatically route your traffic to healthy endpoints.
  • Private DNS: Manage internal DNS names for your Amazon VPC resources without exposing DNS data to the public Internet.
  • Integrations: Works seamlessly with other AWS services like EC2, S3, CloudFront, and Elastic Load Balancing.
How It Works:
  1. A user opens a web browser and enters your domain name (www.example.com).
  2. This request is sent to a DNS resolver.
  3. The DNS resolver forwards the request to a Route 53 name server.
  4. Route 53 refers to the configurations you've set to determine how to respond.
  5. Route 53 returns the appropriate IP address to the DNS resolver.
  6. The DNS resolver provides this IP address to the user's browser.
  7. The browser sends a request to this IP address.
  8. The web server at this IP returns the requested web page.
Benefits:
  • High Availability: Built on AWS's highly available and reliable infrastructure.
  • Flexibility: Provides a variety of routing policies to best suit your needs.
  • Simple: Easy to set up and manage through the AWS Management Console, AWS CLI, or SDK.
  • Cost-Effective: Pay only for the services you use, with no long-term commitments.
  • Secure: Integrates with AWS Identity and Access Management (IAM) for resource control.
  • Scalable: Automatically handles large query volumes without any intervention.
Common Use Cases:
  • Managing DNS for websites and web applications
  • Domain registration and management
  • Implementing complex DNS routing strategies
  • Load balancing and failover for multi-region applications
  • Monitoring health and performance of web resources
  • Managing internal DNS for private networks