Volume 7 · Chapter 9 — Microservices and System Design

AppSync, Service Discovery, and Service Mesh

Goutham Mayaluri 4 min read AWSCloudMicroservicesSystem Design

9.1 Introduction

Beyond API Gateway, the exam expects awareness of AppSync (managed GraphQL), how microservices find each other (Cloud Map service discovery), and how a service mesh (App Mesh) manages service-to-service communication. This chapter covers these so you can design the connective tissue of a microservice architecture.

9.2 AWS AppSync (GraphQL)

AWS AppSyncis a managedGraphQLservice. GraphQL lets clients request exactly the data they need in a single query across multiple sources, avoiding the over-fetching/under-fetching and multiple round-trips of REST - ideal for mobile and web apps that aggregate data. AppSync connects a GraphQL schema to data sources (DynamoDB, Lambda, RDS/Aurora via the Data API, HTTP, OpenSearch), handles authorization (Cognito, IAM, API keys, Lambda), and supportsreal-time subscriptions(push updates to clients over WebSockets) and offline data sync for mobile. The exam pattern: use AppSync/GraphQL when clients need flexible, aggregated data fetching or real-time subscriptions, versus API Gateway REST/HTTP for resource-oriented APIs. It’s the managed way to build a GraphQL backend without running servers.

9.3 Service Discovery with Cloud Map

In a dynamic microservice environment, services must find each other as instances and tasks come and go.AWS Cloud Mapis a service-discovery service - it maintains a registry mapping logical service names to their current healthy endpoints (IPs, ports, or resources), so a service resolves a name to a current location rather than a hardcoded address. It integrates with ECS (tasks register automatically) and can use DNS (via Route 53) or an API for discovery, with health checking so only healthy endpoints are returned. For Kubernetes on EKS, the built-in Kubernetes Service provides discovery. The exam pattern: Cloud Map for service discovery in ECS/microservice environments, keeping service-to-service references current as instances change.

flowchart TB
  SvcA[Service A] -->|resolve 'payments'| CM[Cloud Map registry - healthy endpoints]
  CM --> SvcB[Service B tasks - current IPs]
  Mesh[App Mesh - Envoy sidecars] -.traffic mgmt, mTLS, retries, observability.-> SvcA & SvcB

9.4 App Mesh and Service Mesh Concepts

AWS App Meshis a managedservice mesh- it deploys Envoy proxy sidecars alongside your services to standardize service-to-service communication with consistent traffic management (routing, retries, timeouts, circuit breaking), observability (metrics, logs, traces for every hop), and security (mutual TLS) - configured centrally rather than coded into each service. A mesh is valuable when you have many services and want uniform, out-of-band control over how they communicate and observe each other. The trade-off is added complexity, so it’s for larger, mature microservice estates. The exam pattern: App Mesh (or a service mesh generally) provides consistent traffic control, mTLS, and observability across many services via sidecars, decoupling those concerns from application code.

9.5 Banking Production Scenario

A bank’s mobile app uses AppSync GraphQL to fetch a customer’s dashboard - accounts, recent transactions, and alerts - in one flexible query across DynamoDB and Lambda data sources, with Cognito authorization and real-time subscriptions pushing balance updates. Its ECS microservices register in Cloud Map so services resolve each other’s current healthy endpoints as tasks scale. Across its large service estate, App Mesh standardizes service-to-service communication - mutual TLS between services, consistent retries and timeouts, and uniform tracing of every hop - configured centrally rather than in each service. Resource-oriented public APIs remain on API Gateway. This deliberate use of GraphQL, service discovery, and a mesh is the professional-level microservice connectivity design the certification expects.

9.6 Chapter Revision Notes

  • AppSync = managed GraphQL: clients fetch exactly the data they need across sources in one query, with authorization, real-time subscriptions, and offline sync - for flexible/aggregated data and real-time apps.
  • Use AppSync/GraphQL for flexible aggregated fetching or subscriptions; API Gateway REST/HTTP for resource-oriented APIs.
  • Cloud Map = service discovery: maps service names to current healthy endpoints (DNS or API), integrates with ECS; EKS uses Kubernetes Services.
  • App Mesh = managed service mesh (Envoy sidecars): consistent traffic management, mTLS, and observability across services, decoupled from app code - for large estates.
  • Mesh adds complexity - use it for many services needing uniform communication control, not small deployments.