Skip to content

Architecture Patterns

Well-Architected Framework

Well-Architected Framework


Multi-Tier Architecture

Multi-Tier Architecture


Microservices Architecture

Microservices Architecture


Event-Driven Architecture

Event-Driven Architecture

Event-Driven Implementation

// Event Publisher
@Service
public class OrderEventPublisher {

    private final EventBridgeClient eventBridge;

    public void publishOrderCreated(Order order) {
        PutEventsRequestEntry entry = PutEventsRequestEntry.builder()
            .source("order-service")
            .detailType("OrderCreated")
            .detail(toJson(new OrderCreatedEvent(
                order.getId(),
                order.getUserId(),
                order.getTotal(),
                Instant.now()
            )))
            .eventBusName("orders")
            .build();

        eventBridge.putEvents(PutEventsRequest.builder()
            .entries(entry)
            .build());
    }
}

// Event Consumer (Lambda)
public class OrderCreatedHandler implements RequestHandler<ScheduledEvent, Void> {

    @Override
    public Void handleRequest(ScheduledEvent event, Context context) {
        OrderCreatedEvent orderEvent = parseDetail(event.getDetail());

        // Process event
        notificationService.sendOrderConfirmation(orderEvent);
        inventoryService.reserveItems(orderEvent);

        return null;
    }
}

Serverless Architecture

Serverless Architecture


Multi-Region Architecture

Multi-Region Architecture


Data Lake Architecture

Data Lake Architecture


CQRS Pattern in Cloud

CQRS Pattern


Strangler Fig Pattern

Strangler Fig Pattern


Disaster Recovery Patterns

Disaster Recovery Patterns


Cost Optimization Patterns

Cost Optimization Patterns


Common Interview Questions

  1. How to design for high availability?
  2. Multi-AZ deployments
  3. Auto Scaling
  4. Health checks and failover
  5. Stateless application design

  6. Active-Active vs Active-Passive?

  7. Active-Active: Both regions serve traffic
  8. Active-Passive: Standby only for failover
  9. Trade-offs: cost, complexity, latency

  10. How to handle data consistency across regions?

  11. Eventually consistent replication
  12. Use global tables (DynamoDB)
  13. Design for idempotency
  14. Handle conflicts appropriately

  15. When to use serverless vs containers?

  16. Serverless: Variable load, event-driven, short tasks
  17. Containers: Long-running, predictable load, complex apps

  18. How to migrate from monolith to microservices?

  19. Strangler Fig pattern
  20. Start with bounded contexts
  21. Extract incrementally
  22. Use API Gateway as facade