Home
Softono
designing-cloud-native-microservices-on-aws

designing-cloud-native-microservices-on-aws

Open source Java
318
Stars
78
Forks
8
Issues
9
Watchers
3 weeks
Last Commit

About designing-cloud-native-microservices-on-aws

Introduce a fluent way to design cloud native microservices via EventStorming workshop, this is a hands-on workshop. Contains such topics: DDD, Event storming, Specification by example. Including the AWS product : Serverless Lambda , DynamoDB, Fargate, CloudWatch.

Platforms

Web Self-hosted Cloud

Languages

Java

Links

Designing Cloud Native Microservices on AWS (via DDD/EventStormingWorkshop)

Picture license-free from Pexels

Building software is hard. Understanding the business needs of the software is even harder. In almost every software development project, there will always be some form of gap between the requirements of the business users and the actual implementation.

As a developer, knowing how to narrow this gap can help you go a long way to building applications that are relevant for the users. Using a Domain Driven Design approach, delivered via Event Storming, it can help to reduce the time it takes for everyone in the project team to understand a business domain model.

Theory and Practice: Learning in the Real world cases

Go through all of the learning journey, develop-->build-->deploy artifacts on AWS

πŸ—οΈ Modern Cloud-Native Architecture on Amazon EKS

CoffeeShop EKS Architecture

AWS cloud-native microservices architecture using EKS + Lambda hybrid computing model with event-driven service communication via EventBridge

πŸ“‹ Click to view Mermaid source code
graph TB
    %% External Users and Systems
    User[πŸ‘€ Users] --> ALB[Application Load Balancer]
    Developer[πŸ‘¨β€πŸ’» Developers] --> ECR[Amazon ECR<br/>Container Registry]

    %% Network Layer
    subgraph VPC["🌐 Amazon VPC (10.0.0.0/16)"]
        subgraph PublicSubnet["Public Subnet"]
            ALB
            NAT[NAT Gateway]
        end

        subgraph PrivateSubnet["Private Subnet"]
            %% EKS Cluster
            subgraph EKS["☸️ Amazon EKS Cluster"]
                subgraph Namespace["coffeeshop namespace"]
                    OrdersPod[πŸ“¦ Orders Web<br/>Spring Boot 3.4.1<br/>Java 21]
                    CoffeePod[β˜• Coffee Web<br/>Spring Boot 3.4.1<br/>Java 21]
                    InventoryPod[πŸ“‹ Inventory Web<br/>Spring Boot 3.4.1<br/>Java 21]
                end

                subgraph SystemPods["System Components"]
                    ALBController[AWS Load Balancer Controller]
                    ClusterAutoscaler[Cluster Autoscaler]
                    MetricsServer[Metrics Server]
                    EBSCSIDriver[EBS CSI Driver]
                end
            end

            %% Lambda Functions
            subgraph Lambda["πŸ”§ AWS Lambda"]
                CoffeeOrderHandler[Coffee Order Handler<br/>Java 21]
                InventoryHandler[Inventory Handler<br/>Java 21]
            end
        end
    end

    %% Data Layer
    subgraph DataLayer["πŸ’Ύ Data Layer"]
        DynamoOrder[(πŸ“Š DynamoDB<br/>Order Table)]
        DynamoCoffee[(β˜• DynamoDB<br/>Coffee Table)]
        DynamoInventory[(πŸ“‹ DynamoDB<br/>Inventory Table)]
    end

    %% Event-Driven Architecture
    subgraph EventDriven["πŸ“‘ Event-Driven Architecture"]
        EventBridge[Amazon EventBridge<br/>Event Bus]
    end

    %% API Gateway
    subgraph APILayer["🌐 API Layer"]
        APIGateway[Amazon API Gateway<br/>REST API]
    end

    %% Monitoring and Observability
    subgraph Monitoring["πŸ“Š Monitoring & Observability"]
        CloudWatch[Amazon CloudWatch<br/>Metrics & Logs]
        Dashboard[CloudWatch Dashboard]
        SNS[Amazon SNS<br/>Alarm Notifications]
    end

    %% CI/CD Pipeline
    subgraph CICD["πŸš€ CI/CD Pipeline"]
        Pipeline[EKS Pipeline Stack<br/>Automated Deployment]
    end

    %% Connections
    ALB --> OrdersPod
    ALB --> CoffeePod
    ALB --> InventoryPod

    %% Microservices to Data
    OrdersPod --> DynamoOrder
    OrdersPod --> EventBridge
    CoffeePod --> DynamoCoffee
    InventoryPod --> DynamoInventory

    %% Lambda connections
    APIGateway --> CoffeeOrderHandler
    APIGateway --> InventoryHandler
    CoffeeOrderHandler --> DynamoOrder
    CoffeeOrderHandler --> DynamoCoffee
    InventoryHandler --> DynamoCoffee

    %% Event-driven flow
    EventBridge --> CoffeeOrderHandler
    OrdersPod -.->|Send Events| EventBridge

    %% ECR to EKS
    ECR --> OrdersPod
    ECR --> CoffeePod
    ECR --> InventoryPod

    %% Monitoring connections
    OrdersPod --> CloudWatch
    CoffeePod --> CloudWatch
    InventoryPod --> CloudWatch
    CoffeeOrderHandler --> CloudWatch
    InventoryHandler --> CloudWatch
    EKS --> CloudWatch
    CloudWatch --> Dashboard
    CloudWatch --> SNS

    %% CI/CD
    Pipeline --> ECR
    Pipeline --> EKS

    %% Auto-scaling
    MetricsServer --> OrdersPod
    MetricsServer --> CoffeePod
    MetricsServer --> InventoryPod
    ClusterAutoscaler --> EKS

    %% Styling
    classDef userClass fill:#e1f5fe,stroke:#01579b,stroke-width:2px
    classDef awsService fill:#ff9800,stroke:#e65100,stroke-width:2px,color:#fff
    classDef microservice fill:#4caf50,stroke:#1b5e20,stroke-width:2px,color:#fff
    classDef database fill:#9c27b0,stroke:#4a148c,stroke-width:2px,color:#fff
    classDef monitoring fill:#f44336,stroke:#b71c1c,stroke-width:2px,color:#fff

    class User,Developer userClass
    class ALB,ECR,EKS,Lambda,EventBridge,APIGateway,CloudWatch,SNS,Pipeline awsService
    class OrdersPod,CoffeePod,InventoryPod,CoffeeOrderHandler,InventoryHandler microservice
    class DynamoOrder,DynamoCoffee,DynamoInventory database
    class Dashboard,SNS monitoring

🎯 Architecture Highlights

Container Orchestration (Amazon EKS)

  • Kubernetes Cluster: Managed EKS with ARM64 Graviton3 nodes for cost optimization
  • Microservices: Orders, Coffee, and Inventory services running as containers
  • Auto-scaling: Horizontal Pod Autoscaler (HPA) for dynamic scaling
  • Load Balancing: Application Load Balancer (ALB) for traffic distribution

Event-Driven Architecture

  • Amazon EventBridge: Central event bus for asynchronous service communication
  • Domain Events: OrderCreated, CoffeeRequested, InventoryUpdated events
  • Loose Coupling: Services communicate via events, not direct API calls
  • Event Sourcing: Complete audit trail of all business events

Modern Technology Stack

  • Runtime: Java 21 LTS with enhanced performance features
  • Framework: Spring Boot 3.4.1 with cloud-native optimizations
  • Architecture: Hexagonal Architecture with Domain-Driven Design (DDD)
  • Data Storage: Amazon DynamoDB with pay-per-request billing

Cloud-Native Benefits

  • Scalability: Independent scaling of each microservice
  • Resilience: Fault isolation and automatic recovery
  • Cost Optimization: ARM64 Graviton3 instances reduce compute costs by up to 20%
  • Developer Experience: Modern Java features and Spring Boot productivity

Table of Contents

  • 00 - Event Storming
  • 01 - Hands-on: Events exploring
  • 02 - Cafe business scenario
  • 03 - Roles, Commands, and Events Mapping
  • 04 - Modeling and Development
  • 05 - Deploy Applications on Amazon EKS
  • Showcase Website