Skill 1.1.1
Identify tightly coupled and loosely coupled systems, and use AWS services to decouple system components.
Key Concepts
In a tightly coupled design, one component calls another directly and synchronously and must know its location and interface. If the downstream component is slow or unavailable, the caller fails too, and a spike in traffic hits every component at once.
Loose coupling places an intermediary between components. A queue such as Amazon SQS buffers work so producers and consumers run at their own pace and messages are kept if a consumer fails. Topics and event buses such as SNS and EventBridge let producers publish without knowing who consumes the message, and load balancers hide individual instances behind a single endpoint.
A monolithic application is built and deployed as a single unit, which is simple to start with but forces every change to redeploy everything and makes it hard to scale parts independently. Microservices split the application into small services that own their data and are deployed independently, typically on Lambda or containers behind API Gateway or a load balancer.
In an event-driven architecture, components publish events when something happens and other components react to them, using services such as EventBridge, SNS, SQS and DynamoDB Streams. Fan-out delivers one event to many consumers, usually with SNS feeding several SQS queues or an EventBridge rule with several targets.
When several services take part in a business process, they can be coordinated in two ways. With choreography, each service reacts to events and emits new ones, with no central controller; this is loosely coupled but harder to follow end to end. With orchestration, a central coordinator such as AWS Step Functions calls each step in order, handling retries and branching, which makes the flow visible and easier to manage.
When application servers are stateless, any instance can handle any request, so a load balancer can spread traffic freely and Auto Scaling can add or remove instances without losing user data. Lambda functions should be treated as stateless too: an execution environment may be reused, but there is no guarantee, so nothing important should be kept only in memory or in /tmp.
State that must survive between requests, such as user sessions, shopping carts or workflow progress, should be moved to an external store such as Amazon ElastiCache, Amazon DynamoDB or Amazon S3. Sticky sessions on a load balancer can keep a user on one instance, but they make scaling uneven and lose the session if that instance fails, so an external session store is the preferred answer.