AWS Tutorial

A complete AWS learning path from account setup and networking through compute, data, serverless, operations, and multi-region architecture.

1: Cloud Basics and AWS Global Infrastructure

Amazon Web Services (AWS) is a cloud computing platform that gives you infrastructure, storage, networking, databases, and many other managed services on demand. Before learning individual AWS services, you need a clear picture of the cloud model itself and of the physical and logical structure AWS uses to deliver it.

In simple terms, this chapter explains what cloud computing is, why organizations choose it, and how AWS organizes its global infrastructure through Regions, Availability Zones, and edge locations. This matters because almost every later architecture decision depends on these basics: where you deploy, how you design for failure, who manages which layer, and how you think about availability, latency, and recovery.

You can think of this chapter as the foundation for the rest of the roadmap. It shows how AWS works at a high level, why the shared responsibility model is important, and how the platform is built to support resilient systems before you move into specific services such as Amazon Elastic Compute Cloud (Amazon EC2), Amazon Simple Storage Service (Amazon S3), or AWS Lambda.


1.1 Why Cloud Computing Matters

Cloud computing gives you on-demand infrastructure instead of requiring you to buy and manage physical servers yourself.

The key shift is not only technical. It is operational and financial:

  • You provision resources in minutes instead of waiting for hardware.
  • You pay for usage instead of large upfront purchases.
  • You scale up and down with demand.
  • You outsource part of the infrastructure management to AWS.

That changes how teams plan work. In traditional environments, capacity planning often happens months ahead. In cloud environments, capacity can be adjusted much closer to real demand, which improves agility but also makes poor governance visible faster.

This model lets teams move faster, but it also creates new risks: overspending, weak access control, poor architecture choices, and region-wide dependency mistakes.

For a solutions architect, cloud is not just infrastructure on demand. It is a decision framework. Every major design choice should be reviewed through the AWS Well-Architected pillars:

  • operational excellence
  • security
  • reliability
  • performance efficiency
  • cost optimization
  • sustainability

These pillars help you explain why one architecture is better than another, not just how to deploy it.

This is one of the most important mindset shifts in AWS. Cloud is not only about getting servers quickly. It is about making better trade-offs around security, recovery, speed, and cost from the beginning.


1.2 Core Cloud Service Models

You will repeatedly see three service models:

Infrastructure as a Service (IaaS)

You manage operating systems, runtime, application code, and part of the network design.

Examples:

  • EC2
  • EBS
  • VPC

Platform as a Service (PaaS)

AWS manages more of the operating environment, and you focus more on application logic.

Examples:

  • RDS
  • Elastic Beanstalk
  • ECS Fargate

Serverless

You focus mainly on code and event flow. AWS handles most of the infrastructure operations.

Examples:

  • Lambda
  • API Gateway
  • Step Functions

The higher the abstraction, the less infrastructure you manage. The trade-off is reduced low-level control.

That trade-off also changes the shared responsibility boundary. Moving from EC2 to a managed database or to a serverless function does not remove responsibility. It changes where your effort should go. You spend less time on host operations and more time on identity, data protection, application behavior, and service limits.


1.3 AWS Global Infrastructure

AWS is not one giant data center. It is a global collection of isolated and connected infrastructure units.

That physical and logical separation is one of the core reasons AWS can offer both scale and failure isolation. It is also why architects must think carefully about what happens inside one region versus across multiple regions.

Region

A region is a geographic area where AWS has multiple data center clusters.

Examples:

  • us-east-1 for Northern Virginia
  • eu-west-1 for Ireland
  • ap-south-1 for Mumbai

You choose a region based on:

  • latency to users
  • data residency or compliance requirements
  • service availability
  • disaster recovery design
  • cost

Regions are designed to be strongly isolated from each other. That is good for fault containment, but it also means cross-region designs require deliberate planning for data replication, failover, identity patterns, and operations.

Availability Zone

An Availability Zone, or AZ, is one or more isolated data centers inside a region.

AZs are connected with fast networking, but they are designed so that a failure in one AZ does not automatically take down the others.

This is why production systems often run across multiple AZs in the same region.

Edge Location

An edge location is part of AWS's content delivery and edge network.

It is used for low-latency content delivery and request routing, mainly through services such as CloudFront and Route 53.

Edge locations are closer to end users than regions.

That does not mean they replace regions. Edge locations are mainly used to improve delivery and request handling near users, while the core application and data systems usually still live in regions.

Regional vs Global Services

Not every AWS service behaves the same way:

  • Regional services run inside a selected region, such as EC2, RDS, and VPC.
  • Global services work across the AWS account more broadly, such as IAM, Route 53, and CloudFront control planes.

There are also important nuances:

  • S3 stores data in a chosen region even though bucket names are globally unique.
  • Route 53 is global, but it often routes traffic to regional resources.
  • CloudFront is global, but its origins usually sit in specific regions.

If you miss this distinction, you will misread where your data, access rules, or failures actually live.

This misunderstanding causes real design mistakes. Teams sometimes assume that using a global service means the workload itself is globally resilient, when in reality the application may still depend on one regional database or one regional compute tier.


1.4 Shared Responsibility Model

AWS does not secure everything for you. The cloud changes who is responsible for what.

The exact boundary depends on the service model. With EC2, you manage much more of the operating environment than you do with Lambda or RDS. That is why architects must always ask not only, "What does this service do?" but also, "What does this service leave to us?"

AWS is responsible for security of the cloud

AWS manages things such as:

  • physical data centers
  • hardware
  • networking backbone
  • hypervisor layer

You are responsible for security in the cloud

You manage things such as:

  • IAM permissions
  • data encryption choices
  • operating system patching on EC2
  • security groups
  • application vulnerabilities
  • secrets management

Why this matters

Many teams assume that using AWS means their system is secure by default. That is false.

For example:

  • AWS secures the S3 service.
  • You secure who can read your S3 bucket.

Managed services reduce operational work, but they do not remove accountability.

This is especially important in audits and incident response. If a bucket is public, a key is over-permissive, or a secret is exposed in application code, AWS did not make that decision for you.


1.5 High Availability and Fault Isolation

AWS architecture is built around failure isolation.

Important design rules:

  • One instance in one AZ is not a production architecture.
  • Multi-AZ is the normal baseline for important workloads.
  • Region failure is rare, but it must still be part of disaster recovery planning.

Think in layers:

  • single instance failure
  • AZ failure
  • region failure

Each layer changes cost, complexity, and recovery time.

Another useful term here is blast radius. Blast radius is the scope of damage a single failure can cause. Good architecture reduces blast radius by isolating failures across instances, Availability Zones, accounts, and sometimes regions.

Recovery patterns a solutions architect must know

High availability and disaster recovery are related but not identical.

  • Multi-AZ protects against local infrastructure failure inside one region.
  • Backup and restore is the cheapest regional recovery pattern, but recovery is slow.
  • Pilot light keeps critical data and minimal services ready in a second region.
  • Warm standby runs a reduced-capacity environment in a second region for faster failover.
  • Active-active multi-region gives the best recovery posture, but cost and design complexity rise sharply.

These options are normally evaluated using recovery time objective, or RTO, and recovery point objective, or RPO.

Those metrics are not paperwork. They influence architecture directly. A very low RTO usually requires more pre-provisioned infrastructure. A very low RPO usually requires stronger replication and data protection choices.


1.6 How to Choose a Region

Do not pick a region randomly. Use clear decision criteria.

Choose based on latency

If your users are mostly in India, ap-south-1 may be a better default than us-east-1.

Choose based on compliance

Some workloads must keep data in a specific geography.

Choose based on service support

Not every service or feature launches in every region at the same time.

Choose based on recovery design

If you need disaster recovery, plan a secondary region early.

Choose based on cost

Pricing differs by service and region.

There can also be indirect cost differences. Data transfer, cross-region replication, and operational overhead can change the total cost of a region choice even when the base compute price looks attractive.

Choose based on quotas and ecosystem fit

Architects also check service quotas, partner connectivity, and team operations. A region may be technically available but still be a poor fit if quotas are too low, managed services are missing, or connectivity to on-premises environments is weak.

The best region is usually the one that balances user latency, compliance, service support, recovery design, and team operability. There is rarely a universally correct answer across every workload.


1.7 Example Mental Model

A simple production web application might look like this:

  • One region for primary deployment
  • Two or more AZs for application instances
  • CloudFront edge locations for static content and low-latency delivery
  • Route 53 for DNS routing
  • A managed database in Multi-AZ mode
  • CloudWatch and CloudTrail for visibility and audit
  • Backups and documented recovery procedures

This example is deliberately simple, but it already shows several AWS patterns:

  • global user entry through DNS and edge services
  • regional application hosting
  • Multi-AZ resilience inside the primary region
  • explicit observability and recovery planning instead of assuming resilience automatically exists

This is the first important AWS pattern: keep the application close to users, distribute across AZs, and avoid single points of failure inside a region.

Solutions architect checkpoint

A solutions architect should be able to answer the following after this chapter:

  • Why is Multi-AZ the normal production baseline?
  • When is one region enough, and when is multi-region justified?
  • Which services in the design are regional, global, or edge-based?
  • Which Well-Architected pillar is driving a design trade-off?
  • What are the RTO and RPO expectations for the workload?
  • Where is the biggest blast radius if one component fails?

1.8 Common Mistakes

  • Treating a region as if it were a single data center
  • Assuming all AWS services are global
  • Confusing edge locations with Availability Zones
  • Believing AWS secures your application permissions automatically
  • Designing production workloads in a single AZ
  • Assuming managed services automatically remove the need for resilience planning
  • Choosing a region without considering compliance, service support, or disaster recovery consequences

1.9 Hands-On Checks

Use the AWS documentation and console to verify the following:

  1. Find three regions where EC2 is available.
  2. Identify how many Availability Zones exist in your preferred region.
  3. Check whether IAM is regional or global.
  4. List one service that commonly uses edge locations.
  5. Compare backup and restore, warm standby, and active-active in terms of cost and recovery speed.
  6. Pick one region and explain why it would or would not be a good primary region for a workload serving users in your geography.
  7. Identify one AWS service in your expected stack that is global and one that is regional.
  8. Write down a simple RTO and RPO target for a learning application and explain how that would affect architecture.

1.10 Recap

  • Cloud computing trades fixed infrastructure for on-demand services.
  • AWS organizes infrastructure into regions, AZs, and edge locations.
  • Regions are geographic, AZs provide isolation, and edge locations improve delivery performance.
  • AWS secures the cloud platform, but you still secure your workloads, identities, and data configurations.
  • Multi-AZ thinking is the normal production baseline, and blast-radius reduction is a core design goal.
  • Service model choice affects how much infrastructure you manage and where operational responsibility shifts.
  • Solutions architects use the Well-Architected pillars, service scope, and RTO or RPO goals to justify foundational design choices.

Next: set up an AWS account correctly so you start with strong security and cost controls instead of fixing preventable mistakes later.

2: AWS Account Setup and Cost Guardrails

Your Amazon Web Services (AWS) account is the starting point for everything you build. It controls billing, identity, logging, and access to every service, so a weak setup here can create security risks or unexpected costs very quickly.

This chapter explains how to set up an account so it is safe to learn in and easier to operate later in production. You will see why protecting the root user, turning on billing alerts, and adding basic guardrails matter before you launch real workloads.


2.1 Why Account Setup Matters

Many AWS mistakes happen before the first workload is deployed.

Common examples:

  • the root user has no MFA
  • budgets are not configured
  • billing alerts are missing
  • experiments are run without tags or cleanup discipline

These are not advanced problems. They are foundation problems. Fix them at the start.

Account setup decisions also become sticky. Email ownership, root access practices, billing visibility, and logging defaults are much easier to establish correctly on day one than to retrofit after teams, workloads, and automation already depend on the account.


2.2 Root User Protection

The root user has full control over the AWS account. It should almost never be used for day-to-day work.

Minimum root user checklist

  1. Use a strong unique password.
  2. Enable multi-factor authentication.
  3. Store recovery details safely.
  4. Do not use the root user for routine CLI or console work.

Why this matters

If root access is compromised, the attacker can bypass many normal protections. This is one of the highest-impact account risks.

The root user is best treated as a break-glass identity. It exists for rare account-level actions and recovery scenarios, not for normal administration.


2.3 Basic Account Hygiene

After securing the root user, configure the account so that billing and security signals reach real humans.

Set up:

  • alternate billing contact
  • alternate operations contact
  • alternate security contact
  • account-level notification email that is actively monitored

Those details matter because billing warnings, abuse notices, service notifications, and recovery messages are only useful if they reach a mailbox someone actually watches.

This reduces the chance that warnings or invoices are missed.

Foundational security services to enable early

For a solutions architect, account setup also means creating a minimum governance baseline.

  • CloudTrail for API audit history
  • AWS Config for resource configuration tracking
  • GuardDuty for threat detection
  • Security Hub when you want centralized findings across services and accounts

In a learning account, you may not enable every governance service immediately if cost or complexity is a concern. But you should at least understand which signals you are choosing to delay and why.

These services do not replace secure design, but they improve visibility and response.


2.4 Budget and Billing Guardrails

AWS charges by usage. If you do not monitor usage, the first surprise is often financial.

Create a budget early

Set a modest monthly budget for the learning account.

Examples:

  • total monthly cost budget
  • service-specific budget for EC2 or RDS
  • forecasted spend alert before the actual bill lands

Enable billing alerts

Use billing alerts so you know when usage increases before it becomes expensive.

Billing signals are helpful, but they are not perfect real-time protection. A strong cost posture combines budgets, anomaly detection, tagging, and cleanup habits.

Use Cost Explorer

Cost Explorer helps answer:

  • which service is costing the most
  • whether cost is growing daily or weekly
  • which experiments were not cleaned up

Add cost allocation discipline

Solutions architects should standardize:

  • cost allocation tags
  • budget alerts by environment or workload
  • Cost Anomaly Detection for unusual spend spikes
  • regular cost reviews tied to architecture decisions

This matters because cost is easier to control when you can attribute it. If resources are untagged or environments are mixed together, cost analysis becomes guesswork instead of governance.

Cost control is not only finance work. It is architecture work.


2.5 Free Tier Is Helpful, Not a Safety Guarantee

The free tier reduces learning cost, but it does not guarantee a zero bill.

Important points:

  • not every service is free
  • limits differ by service
  • usage beyond the free threshold is billable
  • some resources keep charging even when you forget about them

Beginners are often surprised by supporting resources rather than by the main service itself. Storage, public IPv4 addresses, snapshots, NAT, and idle infrastructure can outlive the experiment that created them.

Always verify pricing before launching resources.


2.6 Tagging for Control

Tags are key-value labels attached to resources.

They help with:

  • cost tracking
  • ownership
  • environment separation
  • cleanup workflows

Recommended starter tags:

  • Project
  • Environment
  • Owner
  • Purpose

As environments mature, tags often become part of policy and automation. They influence chargeback, access controls, cleanup jobs, reporting, and compliance checks.

Without tags, cost analysis becomes messy very quickly.


2.7 First Admin Setup Pattern

The normal pattern is:

  1. secure the root user
  2. create a dedicated administrative identity
  3. use that identity for normal work

That administrative identity should still follow good discipline:

  • use MFA
  • avoid shared credentials
  • separate admin access from routine lower-privilege work where practical

The detailed access model comes in the IAM chapter, but the principle belongs here: avoid doing regular work as root.

Learning account vs production landing zone

A single account is fine for learning, but it is not a strong production operating model.

A solutions architect should understand the multi-account baseline:

  • separate production and non-production accounts
  • separate security or log archive accounts
  • use AWS Organizations to group accounts
  • apply service control policies, or SCPs, for top-level guardrails
  • use AWS Control Tower when the team wants a managed landing-zone starting point

This pattern reduces blast radius, simplifies billing boundaries, and improves governance.

The point is not complexity for its own sake. The point is that security, audit, and cost boundaries become clearer when production does not share an account with experiments and ad hoc testing.


2.8 Cleanup Discipline

Cloud resources continue to cost money until they are stopped or deleted.

Good habits:

  • terminate test instances when finished
  • delete unused EBS volumes and snapshots
  • remove idle load balancers and NAT gateways
  • clean up old log groups, test buckets, and databases

Cleanup is not just a developer habit. It is a design responsibility. If a team cannot tell which resources are intentionally long-lived and which are leftovers, costs and risk both increase.

The cloud rewards speed, but it also punishes forgotten resources.

Architecturally, this is part of lifecycle management. Every design should include who owns cleanup, when retention applies, and which resources are intentionally persistent.


2.9 Safe Starter Checklist

Before moving to IAM, make sure your account has the following:

  1. Root MFA enabled
  2. Alternate contacts configured
  3. A monthly budget created
  4. Billing alerts enabled
  5. A tagging convention decided
  6. A plan to avoid daily root-user usage
  7. CloudTrail enabled and reviewed
  8. A basic account structure plan for environments and future growth
  9. A monitored notification path for billing and security events
  10. A cleanup habit for temporary resources and experiments

2.10 Common Mistakes

  • using the root user for normal work
  • using personal or unmonitored email paths for important account notifications
  • assuming free tier means free by default
  • launching resources without watching cost
  • expecting budgets alone to stop unwanted spend automatically
  • skipping tags and losing ownership visibility
  • forgetting to clean up storage, IPs, or databases
  • mixing production and experimentation in one account because it feels simpler at the start
  • putting production and experimentation in the same account without a reason
  • delaying audit and logging baselines until after deployment

2.11 Hands-On Tasks

  1. Enable MFA for the root user.
  2. Add alternate billing and security contacts.
  3. Create a monthly budget with alert thresholds.
  4. Open Cost Explorer and inspect available service groupings.
  5. Write down a simple tag policy for future resources.
  6. Draft a two-account or three-account structure for production, non-production, and logging.
  7. Write down which alerts should go to billing contacts, which should go to security contacts, and who should own each response.
  8. List three AWS resources that commonly continue costing money after an experiment ends.
  9. Describe one reason a single learning account is fine now and one reason it becomes weak for production later.

2.12 Recap

  • Root user protection is mandatory, not optional.
  • Budgets, billing alerts, and Cost Explorer are part of the foundation.
  • Tags make cost analysis, ownership tracking, and cleanup manageable.
  • Free tier helps, but it does not remove the need for cost discipline or pricing checks.
  • A clean AWS account starts with strong security, monitored notification paths, and simple operational guardrails.
  • Solutions architects also define landing-zone direction, logging baselines, account boundaries, and lifecycle discipline early instead of retrofitting them later.

Next: learn IAM so the right people and services get the right permissions, and nothing more.

3: IAM Fundamentals

AWS Identity and Access Management (IAM) is the system that decides who can do what in your AWS environment. It is one of the most important AWS services because every action, from opening the console to deploying an application, depends on permissions.

This chapter introduces the main IAM building blocks such as users, groups, roles, and policies. You will learn why least privilege matters, how teams and applications get access safely, and why good IAM design is a foundation for secure production systems.


3.1 What IAM Does

IAM, or Identity and Access Management, controls who can do what in an AWS account.

It is one of the main places where AWS security, operations, and governance meet. Poor IAM design creates both security risk and operational friction. Good IAM design reduces blast radius while still letting teams move.

It answers questions such as:

  • Which human can log in?
  • Which service can read from an S3 bucket?
  • Which application can assume temporary credentials?
  • Which actions are blocked even if someone has broad access?

IAM is a global service and is one of the most important AWS security foundations.

That global scope matters. A permission mistake in IAM can have account-wide consequences even if the affected workload is deployed in only one region.


3.2 Core IAM Building Blocks

Users

An IAM user represents a person or workload that needs direct long-term credentials.

In modern AWS setups, you should minimize long-term credentials whenever possible.

Long-lived IAM users are easy to overuse because they feel simple. In practice, they create more credential lifecycle, rotation, and leakage risk than temporary-role-based access.

Groups

Groups collect users with similar access needs.

Example:

  • developers
  • read-only auditors
  • platform administrators

Groups reduce repeated manual permission assignments.

Roles

Roles are identities that are assumed temporarily.

Roles are widely used for:

  • EC2 instances accessing AWS services
  • Lambda functions calling other services
  • cross-account access
  • temporary admin access

Roles are preferred over hard-coded credentials.

Roles also depend on trust. A role is useful only when the correct principal is allowed to assume it. In practice, role design has two sides:

  • a trust policy that says who may assume the role
  • permission policies that say what the role may do after assumption

Policies

Policies are JSON documents that define permissions.

They specify:

  • actions
  • resources
  • conditions
  • effect, which is allow or deny

Resource-based policies

Some AWS services also support resource-based policies.

These policies are attached to the resource instead of the identity.

Common examples:

  • S3 bucket policies
  • KMS key policies
  • SNS topic policies
  • SQS queue policies

Solutions architects need to know both models because many real designs combine identity-based and resource-based access.

That combination is where many access bugs come from. A user may have permission to call a service, but the target resource may still reject access because its own resource policy does not allow the request.

Federation and IAM Identity Center

For workforce access, modern AWS environments usually prefer federation over large numbers of long-lived IAM users.

Common pattern:

  • users authenticate through an external identity provider
  • access is brokered through IAM Identity Center
  • users assume roles in target accounts

This is easier to manage and usually more secure than distributing permanent AWS credentials.


3.3 How Permission Evaluation Works

IAM evaluation becomes much easier when you remember three rules:

  1. By default, access is denied.
  2. An explicit allow grants access.
  3. An explicit deny overrides allows.

This means a broad allow is not final if another policy denies the action.

That single rule explains many confusing access errors.

Another useful mental model is this:

  • identity-based policies and resource-based policies can grant access
  • guardrails such as SCPs and permission boundaries can narrow what is possible
  • explicit deny overrides the rest

In real environments, permission evaluation often also includes:

  • SCPs from AWS Organizations
  • permission boundaries
  • resource-based policies
  • session policies on assumed roles

As a solutions architect, you do not need to memorize every evaluation edge case on day one, but you must know that permissions are layered.

If you ignore the layered model, you will spend too much time debugging the wrong policy document.


3.4 Least Privilege

Least privilege means granting only the permissions required for a task, and nothing more.

Bad example:

  • giving AdministratorAccess to every developer

Better example:

  • allowing read and write only to the specific S3 bucket required for a project

Least privilege reduces blast radius when credentials are misused or compromised.

In real systems, least privilege is usually iterative. Teams often begin with broader access to understand what a workload needs, then reduce permissions once the required actions and resource scopes are known.

Teams often extend least privilege with attribute-based access control, or ABAC, by using tags such as Environment, Project, or Team in permission conditions.

That works well when tagging discipline is strong. If tags are inconsistent, ABAC becomes harder to trust and troubleshoot.


3.5 Common Policy Structure

A policy usually defines four things:

  • Effect
  • Action
  • Resource
  • optional Condition

Conditions are where policies become more precise. They let you say not only which action is allowed, but under which circumstances. For example, a policy might require MFA, restrict access to certain source networks, or permit actions only when resource tags match expected values.

Example shape:

json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject"],
      "Resource": ["arn:aws:s3:::my-learning-bucket/*"]
    }
  ]
}

You do not need to memorize every policy detail early, but you must understand the model.

The main risk pattern is over-broad scope. If Action or Resource expands farther than intended, the policy may technically work while still violating least privilege badly.


3.6 Managed Policies vs Inline Policies

Managed Policies

Managed policies are reusable permission documents.

They can be:

  • AWS managed
  • customer managed

These are easier to reuse and update across multiple identities.

Inline Policies

Inline policies are attached directly to one principal and usually serve a narrow purpose.

Use them sparingly. Reusable customer-managed policies are usually easier to maintain.

That is mainly an operations decision. Reusable managed policies make review, updates, and consistent permission boundaries easier across many identities.


3.7 Why Roles Matter More Than Beginners Expect

Roles are central to secure AWS design.

Examples:

  • An EC2 instance assumes a role to read secrets.
  • A Lambda function assumes a role to publish to SNS.
  • An engineer assumes an admin role temporarily instead of storing permanent admin keys.

This pattern avoids embedding long-term credentials in files, code, or servers.

It also enables better separation of concerns. The application runtime can receive only the permissions it needs, and engineers can assume stronger permissions only when the task justifies it.

Cross-account access pattern

Cross-account access is a normal operating model in AWS.

Example:

  • an engineer signs in through IAM Identity Center
  • assumes a read-only role in production
  • assumes a broader role in a sandbox account

This keeps permissions scoped to the account and task instead of concentrating every permission in one identity.

Under the hood, AWS Security Token Service, or STS, issues temporary credentials when a role is assumed.

That temporary credential model is one of the most important AWS security defaults. Short-lived credentials reduce exposure time and make credential handling safer than permanent keys stored in many places.


3.8 Multi-Factor Authentication and Temporary Credentials

Strong access control is not only about permissions. It is also about credential quality.

Important practices:

  • enable MFA for privileged users
  • avoid long-lived access keys where possible
  • prefer temporary credentials through roles
  • rotate credentials that must exist

Console and API access also need observability. Access control is stronger when you can answer which principal assumed which role, when the session happened, and what actions followed.

Permanent keys are easy to leak. Temporary credentials reduce the exposure window.

Access analysis and debugging

Solutions architects should know the basic tools for permission troubleshooting:

  • IAM Policy Simulator to test whether a policy should allow an action
  • IAM Access Analyzer to identify broad or unintended access
  • CloudTrail to confirm which principal called which API

Good architecture includes operability, including access debugging.

This is a practical point, not a theory point. If a team cannot explain why access was granted or denied, security becomes slower and less reliable.


3.9 Common IAM Mistakes

  • granting wide permissions to move faster
  • attaching permissions without understanding the role's trust policy
  • using the root user instead of roles or named identities
  • hard-coding access keys into code or configuration files
  • attaching permissions to the wrong resource scope
  • forgetting that explicit deny overrides allow
  • using IAM users for workforce access when federation is available
  • assuming one allow policy is enough without checking SCPs, boundaries, or resource policies
  • forgetting that SCPs or permission boundaries can block apparently valid access

3.10 A Simple Access Design Pattern

For a small team, a clean starter model looks like this:

  1. Human users authenticate through a secure identity workflow.
  2. Developers get scoped permissions through groups or roles.
  3. Workloads use roles instead of static access keys.
  4. Read-only access is separated from administrative access.
  5. Sensitive actions require stronger review and tighter scope.

This pattern becomes stronger when role names, account boundaries, and permission scopes are predictable. Consistency helps both security review and incident response.

This is simple, scalable, and much safer than ad hoc permission grants.

For multi-account environments, add one more rule: use cross-account roles rather than duplicating identities and secrets in every account.


3.11 Hands-On Tasks

  1. Open IAM and identify users, groups, roles, and policies in the console.
  2. Read one AWS managed policy and explain what it grants.
  3. Create a basic group structure on paper for Admin, Developer, and ReadOnly.
  4. Inspect a sample policy and identify the action and resource scope.
  5. List two places where roles are safer than long-term access keys.
  6. Explain when a bucket policy is needed in addition to an IAM policy.
  7. Sketch a cross-account access flow using IAM Identity Center and STS.
  8. Identify the trust side and the permission side of one example role.
  9. Describe one example where an explicit deny should be used deliberately.
  10. Explain how you would troubleshoot an access denial when the identity policy looks correct at first glance.

3.12 Recap

  • IAM controls access to AWS resources.
  • Users, groups, roles, and policies solve different access-control problems.
  • Permissions start with deny, allows grant access, and explicit deny wins.
  • Least privilege is the default security principle, but it must be applied iteratively and reviewed over time.
  • Roles and temporary credentials are safer than hard-coded long-term keys, and trust policies are as important as permission policies.
  • Solutions architects should also understand federation, resource-based policies, and layered permission controls across multiple accounts.

Next: use the console, CLI, and SDKs correctly so you can work with AWS interactively, from scripts, and from applications.

4: Console, CLI, and SDK Workflow

There are three common ways to work with AWS: the web console, the Command Line Interface (CLI), and Software Development Kits (SDKs). They all talk to the same AWS services, but each one fits a different kind of task.

This chapter shows when to use each approach in practice. The console is useful for learning and inspection, the CLI is useful for repeatable operator tasks, and SDKs are how applications call AWS services directly in code.


4.1 The Three Access Modes

AWS work usually happens through one of these interfaces:

  • Console for visual exploration and service configuration
  • CLI for repeatable terminal-based operations
  • SDKs for application code and automation inside programs

They solve different problems. Strong AWS workflow means using the right interface at the right time.

This is not only a productivity decision. It is also a safety decision. The interface you choose affects repeatability, auditability, error rate, and how easily the work can be reviewed or reproduced later.


4.2 When to Use the Console

The AWS Management Console is best for:

  • learning a service for the first time
  • inspecting current resource state
  • reviewing dashboards, logs, and policy details
  • performing guided setup for unfamiliar services

The console is useful, but it is not ideal for repeated operational tasks. Manual clicks do not scale well.

The console can also hide important details if you rely on it too heavily. It is excellent for learning and inspection, but it is weaker as a durable system of record for repeated changes.

AWS CloudShell is also useful for lightweight console-adjacent command execution when you need temporary shell access inside the AWS web environment.


4.3 When to Use the CLI

The AWS CLI is best for:

  • repeatable commands
  • scripting
  • automation in shell workflows
  • quick inspection of configuration and outputs

Example command:

bash
aws s3 ls

The CLI helps you move from manual actions to reliable workflows.

It also makes it easier to script validation steps, gather machine-readable outputs, and rerun known procedures consistently. That is why CLI literacy becomes important long before a team adopts full infrastructure as code.


4.4 When to Use SDKs

AWS SDKs are used when your application code needs to call AWS services directly.

Examples:

  • a Java service writing to DynamoDB
  • a Python script uploading files to S3
  • a Node.js Lambda function publishing to SNS

SDKs are for program logic, not only infrastructure setup.

That distinction matters. If a task belongs inside application behavior, the SDK is appropriate. If it is a one-off operator action or a provisioning step, putting it in application code may create the wrong dependency boundary.


4.5 Basic CLI Setup

A normal starter workflow looks like this:

  1. Install the AWS CLI.
  2. Configure credentials and default region.
  3. Test identity and access.

Common configuration command:

bash
aws configure

Useful verification command:

bash
aws sts get-caller-identity

This confirms which AWS identity your CLI is actually using.

That identity check should become habit. Many costly AWS mistakes are not syntax problems. They are wrong-account or wrong-region problems.

For workforce access in modern AWS environments, aws configure sso is often preferred over storing long-lived access keys.


4.6 Profiles and Environments

Do not force every task to use a single default profile.

Profiles help separate:

  • personal learning account access
  • sandbox access
  • production access
  • different roles or regions

Example:

bash
aws s3 ls --profile learning

Profile separation reduces mistakes, especially when you later work across multiple accounts.

It also reduces mental load. Clear profile names make it easier to stop and verify intent before running a command that changes infrastructure.

For architect workflows, profiles often map to assumed roles such as sandbox-admin, prod-readonly, or shared-services-ops.

That naming pattern is useful because it encodes both environment and privilege level. A profile named prod-readonly is much easier to reason about safely than a generic default profile used for everything.


4.7 Output, Querying, and Scripting

The CLI becomes much more useful when you shape its output.

Common patterns:

  • human-readable tables for quick review
  • JSON output for automation
  • filtered output for scripts

Choosing the right output format matters. Commands meant for humans and commands meant for automation should not be treated the same way.

Example:

bash
aws ec2 describe-instances --output json

CLI workflows become powerful when combined with shell scripting, but always verify the target account and region before running mutating commands.

Scripts also need operational discipline. They should fail clearly, log intent, and avoid hidden assumptions about the active profile or default region.

Architects should also be comfortable with:

  • --query for extracting only needed fields
  • pagination behavior on large result sets
  • explicit --region usage when commands must not depend on defaults
  • tagging commands and outputs so automation remains traceable

These details matter because automation often fails at edges: unexpected pagination, missing filters, wrong region defaults, or scripts that parse human-formatted output instead of stable machine-readable output.


4.8 How SDK Credentials Usually Work

SDKs usually do not require you to hard-code credentials directly in source code.

Good patterns:

  • local development uses configured profiles or environment-based credentials
  • EC2 uses instance roles
  • Lambda uses execution roles
  • containers use task roles or equivalent runtime identity

This usually works through a credential provider chain. The SDK checks several possible credential sources in a defined order and uses the first valid one it finds.

This connects directly to the IAM chapter: secure access comes from roles and temporary credentials.

SDK workflows also require a few architectural habits:

  • use the default credential provider chain instead of hard-coded secrets
  • design for retries and exponential backoff when APIs throttle
  • handle idempotency where repeated API calls must not duplicate outcomes
  • log request context carefully without exposing secrets

That provider-chain behavior is useful, but it can also surprise teams. If the runtime picks up credentials from an unexpected environment variable or local profile, the application may talk to the wrong account without obvious signs.


4.9 Choosing the Right Interface

Use this decision model:

Choose console when

  • you are learning
  • you need visual inspection
  • you are validating settings manually

Choose CLI when

  • the task is repeated
  • you want auditability in scripts
  • you need fast terminal operations
  • you need structured outputs for follow-up automation or validation

Choose SDK when

  • an application must call AWS during runtime
  • business logic depends on AWS responses
  • the task belongs inside software, not in a shell command

The architect question is not, "Which tool can do this?" It is, "Which interface puts this responsibility in the right place?"

One more architect rule: provision through code

Even though infrastructure as code is covered later, a solutions architect should adopt the principle early:

  • use the console for learning and inspection
  • use the CLI for repeatable operations and validation
  • use SDKs for application runtime behavior
  • use infrastructure as code for durable provisioning changes

This reduces click-ops drift and makes reviews, rollback, and audit much easier.

The usual maturity path looks like this:

  • console for learning and inspection
  • CLI for repeatable operator workflows
  • SDK for runtime service integrations
  • infrastructure as code for durable provisioning changes

The earlier that pattern becomes normal, the easier later automation work becomes.


4.10 Common Mistakes

  • hard-coding credentials in application code
  • forgetting to verify the active account and region
  • using one default profile for every environment and privilege level
  • relying on console-only workflows for repeatable operations
  • using a default profile blindly across environments
  • treating CLI automation as safe without reviewing permissions
  • parsing human-readable CLI output in scripts instead of stable machine-readable output
  • making production infrastructure changes manually when they should be codified
  • assuming the SDK is using the intended credentials without understanding provider-chain precedence
  • ignoring API throttling and retry behavior in SDK-based integrations

4.11 Hands-On Tasks

  1. Install the AWS CLI.
  2. Run aws configure for a learning profile.
  3. Run aws sts get-caller-identity and inspect the result.
  4. List S3 buckets or another harmless read-only resource.
  5. Explain one task better suited to the console, one to the CLI, and one to an SDK.
  6. Describe a safe profile strategy for sandbox, production read-only, and production admin access.
  7. Explain why infrastructure provisioning should eventually move to IaC instead of console-only changes.
  8. Run a harmless read-only command with an explicit profile and region, then explain what safety problem that avoids.
  9. Describe one case where JSON output is the right choice and one where table output is enough.
  10. Explain how an SDK running on EC2 should obtain credentials without storing access keys on disk.

4.12 Recap

  • The console is best for exploration and visual inspection.
  • The CLI is best for repeatable commands and automation.
  • SDKs are for runtime access inside application code and should normally rely on credential provider chains and temporary credentials.
  • Profiles, identity checks, and region awareness prevent common wrong-account and wrong-region mistakes.
  • Secure workflows depend on IAM roles and temporary credentials, not hard-coded secrets.
  • Solutions architects also treat repeatability, auditability, and multi-account safety as first-class workflow requirements.

Next phase: start building real infrastructure with networking and compute services such as VPC and EC2.

5: VPC Fundamentals

Amazon Virtual Private Cloud (Amazon VPC) is the networking layer for many AWS workloads. It gives you a private network boundary where you choose IP ranges, divide resources into subnets, and control how traffic enters, leaves, and moves between systems.

This chapter explains why VPC design matters for both security and reliability. You will learn how ideas like Classless Inter-Domain Routing (CIDR) blocks, route tables, internet access, Network Address Translation (NAT), security groups, and network access control lists (ACLs) work together at a high level.


5.1 Why VPC Matters

Most AWS workloads do not fail because a virtual machine could not boot. They fail because the network design was unclear, overly open, or too tightly coupled to a single failure domain.

Amazon VPC is the network boundary for many AWS services. It decides:

  • which private IP ranges your resources can use
  • which resources can be reached from the internet
  • which subnets live in which Availability Zones
  • how traffic flows between subnets, gateways, and external networks
  • how much network isolation exists between application layers

For a solutions architect, VPC is not just a place to launch EC2 instances. It is the base layer for security, availability, and traffic control.


5.2 What a VPC Actually Is

An Amazon VPC is a logically isolated virtual network inside an AWS region.

Inside that VPC, you define address ranges and divide them into subnets. You then attach routing and security controls to determine how traffic should move.

That isolation is logical, not magical. A workload is not secure just because it lives inside a VPC. If an instance has a public IP address, an internet path, and permissive security rules, it can still be directly exposed.

Important boundaries to remember:

  • A VPC is regional.
  • Subnets live in one Availability Zone each.
  • Security groups attach to resources such as EC2 instances and elastic network interfaces.
  • Route tables decide where traffic goes, but they do not inspect whether the traffic should be allowed.

This means networking in AWS is made of multiple layers working together:

  • addressing
  • placement
  • routing
  • ingress and egress control

If you confuse those layers, troubleshooting becomes slow and designs become risky.


5.3 CIDR Blocks and Address Planning

Every VPC starts with an IPv4 Classless Inter-Domain Routing, or CIDR, block such as 10.0.0.0/16.

That range defines how many private IP addresses the VPC can use.

The prefix length matters:

  • a smaller prefix number such as /16 gives a larger address space
  • a larger prefix number such as /24 gives a smaller address space

There are also AWS-specific planning consequences:

  • each subnet reserves a small set of addresses for AWS use
  • very small subnets can run out of usable addresses earlier than beginners expect
  • aggressive subnet fragmentation makes future redesign harder

For beginners, the important lesson is not binary math. It is planning.

You should choose a CIDR block that:

  • leaves room for growth
  • does not overlap with on-premises or other cloud networks you may later connect to
  • supports multiple subnets across multiple Availability Zones

Common planning mistake:

  • choosing a tiny range that works for one demo but blocks future expansion

Production-aware planning questions:

  • Will this VPC later connect to a corporate network over VPN or Direct Connect?
  • Will you need separate subnets for web, application, database, and internal services?
  • Will multiple environments eventually need to peer or connect through a transit design?

One practical pattern is to allocate a VPC CIDR block large enough to leave unused space for later subnet tiers, extra Availability Zones, or service growth. Running out of address space in a live environment is one of those problems that looks small during setup and expensive during migration.

If overlapping address ranges exist, future connectivity becomes painful. Network address translation can sometimes hide the problem, but it is usually an architectural tax rather than a good design.


5.4 Subnets and Availability Zone Design

A subnet is a slice of the VPC CIDR range that exists in exactly one Availability Zone.

Subnets are where resources are actually placed.

The most common high-level split is:

  • public subnets for internet-facing load balancers, bastion patterns, or edge-facing components
  • private subnets for application servers, internal services, and databases

Some teams also distinguish isolated subnets:

  • isolated private subnets with no route to an internet gateway and no route to a NAT gateway

That isolated pattern is common for databases and tightly controlled internal services.

Two rules matter immediately:

  • A subnet does not become public because of its name.
  • A subnet becomes public only when its route table includes a route to an internet gateway and the resource can receive a public IP or public entry point.
  • A resource in a public subnet is still not directly reachable from the internet if it has no public IP address and is not behind a public-facing service.

Good subnet design usually includes one subnet of each needed type in each Availability Zone you plan to use. For example, in a two-AZ design you might create:

  • public subnet A
  • public subnet B
  • private application subnet A
  • private application subnet B
  • private data subnet A
  • private data subnet B

This gives you better fault isolation and cleaner separation between tiers.


5.5 Route Tables and Traffic Flow

Route tables tell AWS where traffic should go next.

Each subnet is associated with a route table, and that table contains rules such as:

  • local traffic for the VPC CIDR stays inside the VPC
  • internet-bound traffic goes to an internet gateway
  • outbound traffic from private subnets goes to a NAT gateway
  • traffic to another network goes to a virtual private gateway, transit gateway, or peering target

AWS uses the most specific matching route. That matters when a subnet has multiple possible destinations, such as local VPC traffic, internet egress, and connectivity to another private network.

Routing answers the question, "Where should this packet go?"

It does not answer the question, "Should this packet be allowed?"

That distinction matters because teams often debug the wrong layer. A route can be correct while a security group blocks the traffic. A security group can be open while the route is missing.

A useful way to reason about VPC routing is to trace one inbound flow and one outbound flow:

  1. A user request reaches a public load balancer in a public subnet.
  2. The load balancer forwards the request to an application target in a private subnet.
  3. The application reaches a database in a private or isolated data subnet.
  4. If the application needs software updates or a third-party API, outbound traffic leaves through a NAT path from the private subnet.

If you cannot describe the route for each step, the design is not fully understood yet.

Architecturally, route tables should reflect intent clearly. If every subnet shares one route table with mixed behavior, the design becomes harder to reason about and easier to misconfigure.


5.6 Internet Gateways and Public Connectivity

An internet gateway, or IGW, allows communication between a VPC and the public internet.

Attaching an internet gateway to a VPC does not automatically make everything public.

For a resource to be internet-reachable, several things usually need to line up:

  • the VPC has an attached internet gateway
  • the subnet route table sends internet-bound traffic to that internet gateway
  • the resource has a public IP address or sits behind a public-facing load balancer
  • security controls allow the intended traffic

This layered model is useful because it prevents accidental exposure from a single misstep.

In production, direct internet exposure should be limited. Common patterns include:

  • public Application Load Balancer in public subnets
  • NAT gateways in public subnets for private-tier outbound traffic
  • application instances in private subnets
  • databases in private subnets with no direct internet path

That is why many well-designed VPCs use public subnets for infrastructure edge components, not for the main application runtime itself.

That reduces attack surface and creates a cleaner trust boundary.


5.7 NAT Gateways and Private Outbound Access

Private subnets are often meant to avoid inbound internet access while still allowing outbound connections.

Typical reasons include:

  • downloading operating system updates
  • reaching third-party APIs
  • pulling packages or container layers
  • calling AWS public service endpoints when private endpoints are not used

This is where a NAT gateway is commonly used.

A NAT gateway sits in a public subnet and lets resources in private subnets initiate outbound connections to the internet without allowing unsolicited inbound connections from the internet back to them.

The production trade-offs are important:

  • NAT gateways are operationally simple compared with self-managed NAT instances
  • NAT gateways add cost per hour and per gigabyte processed
  • if you place only one NAT gateway in one Availability Zone, private subnet egress can become an availability and data transfer concern

NAT gateways also solve a specific problem only: outbound internet access initiated from private resources. They do not make a private subnet publicly reachable, and they are not a substitute for a load balancer, a bastion pattern, or remote administration design.

Many production designs place one NAT gateway per Availability Zone and keep private subnets in each AZ routed to the NAT gateway in the same AZ. This improves resilience and avoids unnecessary cross-AZ traffic charges.

Another production consideration is whether the traffic really needs general internet egress at all. If the workload mostly talks to AWS services such as object storage or managed data services, private connectivity options may reduce NAT dependence, cost, and public-path exposure. The main lesson is to use NAT where it fits, not as the default answer to every outbound traffic need.


5.8 Security Groups and Network ACLs

Security groups and network access control lists, or NACLs, are both network security controls, but they operate differently.

Security groups

Security groups are attached to resources.

Important traits:

  • stateful
  • allow rules only
  • return traffic is automatically allowed for approved flows

Stateful behavior is the reason security groups are usually easier to operate. If you allow an inbound application flow, the return path does not need a second mirrored rule.

Security groups are the primary day-to-day control for workload traffic.

Examples:

  • allow HTTPS from the internet to a load balancer
  • allow application instances to receive traffic only from the load balancer security group
  • allow database access only from the application security group

Referencing one security group from another is powerful because it expresses trust by workload role instead of by broad IP range.

This is usually a cleaner design than allowing large internal CIDR ranges everywhere. It lets you say, in effect, "only resources in this application tier may talk to this database tier."

Network ACLs

NACLs are attached to subnets.

Important traits:

  • stateless
  • explicit allow and deny rules
  • evaluated in numbered order

Stateless behavior means both directions of a flow must be considered. That is where many NACL problems begin. A request may be allowed in one direction while the return traffic fails because the corresponding response path was never permitted.

NACLs are usually a coarse-grained subnet guardrail, not the primary application security mechanism.

This is especially relevant for ephemeral response ports. A design that looks correct at the application port level can still fail if the NACL blocks return traffic patterns.

For many beginner and intermediate designs, careful security group usage matters more than complex NACL tuning. Overusing NACLs early often adds confusion without adding meaningful protection.


5.9 Core VPC Patterns, Traffic Walkthroughs, and Architect Decisions

One common baseline pattern is a multi-AZ three-tier architecture:

  • public subnets contain the internet-facing load balancer
  • private application subnets contain EC2 instances or container tasks
  • private data subnets contain databases and internal data services

This pattern supports several good architectural defaults:

  • internet exposure is limited to a small set of entry points
  • application compute can scale privately
  • databases remain non-public
  • failure in one Availability Zone does not necessarily take down the whole workload

You can test whether the design is sound by walking one realistic request through it:

  1. A client reaches the internet-facing load balancer.
  2. The load balancer sends traffic only to healthy targets in private application subnets.
  3. The application talks to the database on the minimum required port.
  4. Outbound dependency calls leave through a controlled private egress path.
  5. No tier accepts broader traffic than it needs.

This kind of walkthrough exposes mistakes quickly. If a database subnet needs no inbound internet access and no outbound internet access, it should not quietly inherit those paths from a shared route or shared subnet type.

When reviewing a VPC design, ask these questions:

  • Which resources actually need inbound internet access?
  • Which resources only need outbound internet access?
  • Are subnets spread across enough Availability Zones for the availability target?
  • Is the CIDR plan large enough for future environments and integrations?
  • Are routing and security controls simple enough to audit?
  • Can operators explain the traffic path from user request to database response?

When troubleshooting connectivity, a practical order is:

  1. confirm the source and destination addresses or services
  2. confirm the route exists
  3. confirm security groups permit the flow
  4. confirm any NACL rules allow both directions when relevant
  5. confirm the target is actually healthy and listening

If the answer to the last question is unclear, the network design is probably too implicit.


5.10 Common Mistakes

  • treating public and private as naming labels instead of routing behavior
  • putting databases in public subnets because it seems simpler
  • choosing overlapping CIDR ranges that block future connectivity
  • choosing subnet sizes so small that normal growth or reserved addresses become a problem quickly
  • using one flat subnet design for every workload tier
  • enabling public IP assignment in places that were intended to stay private
  • exposing EC2 instances directly when a load balancer would be safer
  • assuming a NAT gateway provides inbound reachability when it only supports outbound initiated traffic
  • relying only on NACLs while leaving security groups overly broad
  • breaking traffic with stateless NACL rules that do not account for response paths
  • deploying only one NAT gateway for a multi-AZ production workload without understanding the availability and cost trade-off
  • treating the default VPC as a production design instead of a convenience starting point
  • debugging only security groups when the route table is actually wrong

5.11 Hands-On Tasks

  1. Create a VPC design on paper or in a diagram with a /16 CIDR range.
  2. Divide it into public and private subnets across at least two Availability Zones.
  3. Write down which route table each subnet should use.
  4. Explain why a public subnet needs an internet gateway route.
  5. Explain why a private subnet may still need outbound access through NAT.
  6. Define one security group for a load balancer, one for an application tier, and one for a database tier.
  7. Describe whether each layer should accept traffic from the internet, from another security group, or from nowhere.
  8. Review your design and identify whether any address ranges could cause overlap with future networks.
  9. Trace one user request from the internet to the load balancer, then to the application tier, then to the database tier.
  10. For that same design, trace one outbound request from the application tier to a patch repository or external API.
  11. Describe one failure caused by a missing route and one failure caused by a blocked security control.
  12. Explain whether your data subnet should be private with controlled egress or fully isolated with no internet path at all.

5.12 Recap

  • A VPC is the regional network boundary for many AWS workloads.
  • CIDR planning affects future scale and connectivity, not just initial setup.
  • Subnets are AZ-specific and should reflect workload tier, exposure level, and availability goals.
  • Public, private, and isolated subnet behavior comes from routing and reachability, not naming alone.
  • Route tables control where traffic goes, while security controls decide whether it is allowed.
  • Internet gateways support public connectivity, and NAT gateways support private outbound access without opening inbound internet reachability.
  • Security groups are the main workload-level traffic control, while NACLs provide subnet-level filtering and require careful handling because they are stateless.
  • Good VPC design reduces attack surface, improves resilience, and makes traffic paths and failure analysis easier to reason about.

Next: EC2 Essentials.

6: EC2 Essentials

Amazon Elastic Compute Cloud (Amazon EC2) gives you virtual machines in AWS. It is a core service because it lets you run operating systems, install software, and control the environment more directly than many higher-level AWS options.

This chapter explains how EC2 is used for real workloads and what choices matter most. You will learn why instance type, Amazon Machine Image (AMI), storage, and pricing model affect performance, reliability, and cost when you run servers in production.


6.1 Why EC2 Still Matters

Even though AWS offers many managed and serverless services, EC2 remains one of the most important building blocks in the platform.

You use EC2 when you need:

  • operating system level control
  • custom runtimes or software packages
  • predictable compute environments
  • legacy application support
  • special hardware such as graphics processing units, or GPUs

EC2 is infrastructure as a service. That means AWS gives you the virtual machine, but you still own major operational responsibilities such as operating system patching, process management, instance hardening, and much of the runtime behavior.

This flexibility is powerful, but it is also where teams often reintroduce old data center habits into the cloud.


6.2 What an EC2 Instance Actually Includes

An EC2 instance is not just a virtual server. It is a combination of several decisions:

  • the Amazon Machine Image, or AMI
  • the instance type
  • the VPC and subnet placement
  • attached storage such as Elastic Block Store, or EBS
  • attached security groups
  • an IAM role for AWS API access
  • bootstrap configuration such as user data

There are also less obvious decisions that matter in production:

  • which CPU architecture the workload expects
  • whether the instance should receive a public IP address
  • whether the root volume should persist after termination
  • how the instance will be monitored, patched, and replaced

If any one of these choices is wrong, the instance may launch but still be unusable, insecure, or too expensive.

This is why architects treat instance creation as a template problem, not a one-click problem. You are defining a repeatable compute pattern, not just booting a box.


6.3 Instance Families and Workload Fit

EC2 instance types are grouped into families based on resource profile.

The most common categories are:

  • general purpose for balanced compute and memory
  • compute optimized for CPU-heavy tasks
  • memory optimized for in-memory databases, caches, and large heap applications
  • storage optimized for high local throughput or low-latency local disks
  • accelerated computing for GPU or specialized hardware workloads

Examples:

  • t3 or t4g for low-to-moderate general workloads
  • m7i or similar families for balanced production workloads
  • c7i for compute-heavy application servers or batch processing
  • r7i for memory-heavy services

Another real decision is processor architecture:

  • x86-based instances fit the widest range of existing software
  • Arm-based instances such as Graviton families can improve price-performance when the software stack supports them

This is not just a cost topic. It affects compatibility with operating system images, agents, libraries, and compiled application components.

The right question is not, "Which family is newest?"

The right question is, "Which family matches the dominant bottleneck of this workload?"

If your application is CPU-bound, adding more memory does not solve the problem. If your application holds large datasets in memory, a cheap burstable instance usually becomes the wrong choice quickly.

The same logic applies to network-heavy and storage-heavy workloads. If a service spends much of its time waiting on network throughput or disk operations, choosing by vCPU count alone leads to the wrong result.


6.4 Sizing, Bursting, and Performance Reality

Instance size affects vCPU count, memory, network bandwidth, and sometimes storage performance.

Beginners often choose too small an instance and then misread the symptoms. Slow response time may come from:

  • CPU saturation
  • memory pressure and swapping
  • network limits
  • EBS throughput limits
  • poor application tuning

Burstable instances such as t3 and t4g deserve special attention. They are cost-effective for workloads with low baseline usage and short bursts, but they are a bad fit for systems that run at sustained high CPU utilization.

It is also worth separating vertical scaling from horizontal scaling:

  • vertical scaling means moving to a larger instance size
  • horizontal scaling means adding more instances behind a load balancer or worker pool

Vertical scaling is simple, but it has limits and can increase blast radius. Horizontal scaling is often better for stateless application tiers, though it requires the application to tolerate replacement and distribution.

Architectural implications:

  • use burstable instances for light services, dev environments, or low-duty workloads
  • use steady-performance families for consistently busy production services
  • benchmark based on real workload behavior instead of guessing from marketing labels
  • observe CPU, memory, storage, and network behavior together before resizing

Right-sizing is not a one-time launch decision. It is an operational practice.


6.5 Amazon Machine Images and Launch Consistency

An AMI defines the base software image for an EC2 instance.

It usually includes:

  • the operating system
  • optional preinstalled software
  • configuration choices needed at launch

Common AMI sources include:

  • AWS-managed AMIs
  • marketplace AMIs
  • your own custom golden images

Production guidance:

  • prefer approved, patched base images
  • minimize unnecessary software in the image
  • version your AMIs clearly
  • avoid manual snowflake instances that drift from the intended baseline

The main trade-off is boot speed versus configuration flexibility:

  • richer images reduce launch-time setup work and improve startup consistency
  • lighter images reduce image sprawl and push more configuration into automation

Custom AMIs are useful when boot time matters or when every instance must start from a controlled image. However, an AMI should not become a dumping ground for untracked configuration. Pair images with automation and clear versioning.

In production, image pipelines matter. If teams do not rebuild and revalidate images regularly, old packages and outdated agents quietly become part of the baseline.


6.6 Storage Choices: EBS and Instance Store

Most EC2 instances use Amazon EBS for persistent block storage.

EBS is useful because:

  • data can survive instance stop and start cycles depending on configuration
  • volume size and type can be chosen per workload
  • snapshots support backup and recovery workflows

In practice, EBS choices also affect performance. General-purpose volumes are suitable for many common workloads, but high-throughput or high-IOPS systems need more deliberate sizing and volume selection.

Instance store is different. It provides physically attached temporary storage on certain instance types.

Important distinction:

  • EBS is persistent block storage for most normal server use cases
  • instance store is ephemeral and should only hold data that can be lost and recreated

Another operational distinction is lifecycle behavior:

  • stopping an instance usually preserves attached EBS volumes unless configured otherwise
  • terminating an instance may delete the root volume depending on launch settings
  • instance store data does not survive the loss or termination of the instance

Examples:

  • root volume and application data on EBS
  • scratch space or temporary cache on instance store

If the business cannot tolerate losing the data, that data should not live only on ephemeral local storage.

Storage design is not only about capacity. It is about durability, throughput, latency, recovery, and cost. Later chapters go deeper into EBS and EFS, but EC2 design already depends on knowing that local temporary storage and durable network-attached storage are not interchangeable.


6.7 Access, Identity, and Safe Bootstrap

Launching the instance is only part of the job. You also need a safe operating model.

Key controls include:

  • security groups for traffic filtering
  • IAM roles for AWS API access from the instance
  • user data for launch-time bootstrap actions
  • Systems Manager based access patterns instead of broad direct shell exposure where possible
  • logging and monitoring agents or equivalent observability controls

Production principles:

  • do not bake long-lived AWS credentials into the instance
  • do not expose SSH or RDP from the internet unless there is a clear operational reason
  • use IAM roles so applications receive temporary credentials
  • keep bootstrap logic predictable and idempotent
  • prefer private administration paths over public management access where possible

User data is useful for startup tasks such as package installation or agent registration, but large, fragile startup scripts often become a hidden source of failure. If a service depends on long initialization logic, that dependency should be explicit and observable.

The broader principle is that instance access should support operations without turning every server into a manually managed snowflake. If human access is the primary recovery method, the design is already too dependent on individual machines.


6.8 Pricing Models and Cost Trade-Offs

EC2 pricing changes based on how flexible your workload is.

The main models are:

  • On-Demand for short-term or unpredictable usage
  • Savings Plans or Reserved Instance style commitments for steady usage patterns
  • Spot Instances for interruptible capacity at lower cost
  • Dedicated options for specialized isolation requirements

How to choose:

  • use On-Demand when the workload is new or variable
  • use commitment-based pricing when usage is predictable enough to justify it
  • use Spot when interruption is acceptable and the system can recover gracefully

Spot is powerful for batch jobs, stateless workers, queue consumers, and fault-tolerant processing. It is a poor fit for single-instance critical systems.

Commitment-based discounts also need discipline. They save money only when the workload shape is steady enough and the organization is confident the usage will remain. Buying too early can lock in the wrong assumption.

Architects should separate workload behavior from pricing behavior. First decide what failure tolerance the application has. Then choose the cheapest pricing model that fits that tolerance.

One common pattern is mixed capacity:

  • baseline capacity on On-Demand or commitment-backed instances
  • burst or worker capacity on Spot when interruption is acceptable

That gives cost efficiency without making the whole service dependent on interruptible capacity.


6.9 Availability, Lifecycle, and Replacement Strategy

An EC2 instance is disposable infrastructure, or at least it should be treated that way.

You should not design around one precious server that must never fail.

Important realities:

  • an instance can fail
  • an Availability Zone can fail
  • stopping and starting an instance may change its underlying host and public IP behavior
  • scaling events may replace instances unexpectedly
  • operating system drift accumulates if instances live too long without rebuild discipline

This is why good EC2 architecture usually includes:

  • instances spread across multiple Availability Zones
  • data stored outside the instance when durability matters
  • launch templates or image standards for consistent replacement
  • monitoring and health checks so unhealthy instances are detected quickly

There is also a lifecycle mindset difference between cloud-native and legacy operations:

  • legacy thinking protects the individual server
  • cloud thinking protects the service and assumes the server can be recreated

That shift affects patching, deployments, incident response, and capacity planning. If recovery requires logging into one irreplaceable host and repairing it manually, the architecture has not yet absorbed the cloud model.

The next chapter expands this into Elastic Load Balancing and Auto Scaling, but the mindset starts here: if replacement is difficult, the design is too instance-centric.


6.10 Common Mistakes

  • choosing instance types by guesswork instead of workload profile
  • ignoring CPU architecture compatibility when evaluating Graviton or other instance families
  • using burstable instances for constantly busy production workloads
  • treating one manually configured instance as the permanent server
  • assuming more vCPU always fixes a workload that is really storage-bound or network-bound
  • storing critical data only on ephemeral instance storage
  • forgetting root volume deletion behavior and losing data unexpectedly at termination
  • hard-coding AWS credentials on the machine instead of using an IAM role
  • exposing management ports directly to the internet without strong operational controls
  • building startup logic so fragile that replacement instances take too long to become useful
  • buying commitment-based pricing before usage patterns are stable enough to justify it
  • assuming larger instance size is the only solution to every performance problem

6.11 Hands-On Tasks

  1. Pick three example workloads: a small internal web app, a memory-heavy cache-backed service, and a batch image-processing worker.
  2. Choose an EC2 family for each workload and explain why.
  3. Decide whether each workload is a good or bad candidate for burstable instances.
  4. Compare when you would use EBS and when you would use instance store.
  5. Describe what should go into an AMI versus what should run in user data.
  6. Explain why an IAM role is safer than storing access keys on the instance.
  7. Choose whether each workload should run On-Demand, Spot, or under a longer-term commitment model.
  8. Describe how you would replace a failed instance without manual reconstruction.
  9. For one workload, decide whether x86 or Arm is the better fit and explain the compatibility check you would perform first.
  10. Choose whether the root volume should persist after termination for three different example servers.
  11. List the metrics you would inspect before deciding whether a slow instance needs a larger size.
  12. Describe one design where horizontal scaling is better than vertical scaling and one where the opposite may be more practical.

6.12 Recap

  • EC2 gives you flexible compute, but you keep significant operational responsibility.
  • Every instance is a combination of image, size, network placement, storage, and identity decisions.
  • Instance families should match workload bottlenecks such as CPU, memory, storage, network, or accelerator needs.
  • Processor architecture compatibility matters, especially when comparing x86 and Arm-based options.
  • AMIs and launch standards improve consistency and reduce configuration drift.
  • EBS is the normal persistent storage choice, while instance store is temporary and should hold only recreatable data.
  • Pricing models should follow workload interrupt tolerance, predictability, and how much interruption the system can absorb.
  • Strong EC2 architecture assumes instances can be replaced rather than preserved forever.

Next: Elastic Load Balancing and Auto Scaling.

7: Elastic Load Balancing and Auto Scaling

Most production applications cannot depend on one server. Elastic Load Balancing spreads incoming traffic across multiple targets, and Auto Scaling adjusts capacity when demand changes or when instances fail.

This chapter shows how these services help keep applications available and responsive. You will learn why health checks, target groups, and scaling rules are important, and how AWS uses them to replace unhealthy compute and add or remove capacity automatically.


7.1 Why This Layer Matters

One EC2 instance can run an application. It cannot provide a serious availability story on its own.

Real workloads need two capabilities:

  • traffic distribution so users are not pinned to one server
  • capacity adjustment so the system can react to load and failure

Elastic Load Balancing and Auto Scaling solve these problems together.

Without them, common failure modes become severe:

  • one instance failure becomes an outage
  • traffic spikes overload the fixed server count
  • deployments require manual replacement and risky handoffs

This chapter turns EC2 from single-server compute into a more resilient application tier.


7.2 Elastic Load Balancing Overview

Elastic Load Balancing, or ELB, is a family of managed traffic distribution services.

The main modern options are:

  • Application Load Balancer, or ALB, for HTTP and HTTPS traffic with Layer 7 routing features
  • Network Load Balancer, or NLB, for very high-performance Layer 4 traffic using TCP, UDP, and TLS patterns
  • Gateway Load Balancer, or GWLB, for specialized inline network appliance scenarios

For most web applications, the first design choice is between ALB and NLB.

That decision affects more than protocol support. It affects where routing logic lives, how much application awareness the traffic layer has, and what kind of observability or request control you can apply at the edge.

As a rule:

  • choose ALB when you need request-aware routing based on host, path, or HTTP behavior
  • choose NLB when you need very high throughput, static IP behavior, or non-HTTP transport handling

Most beginner architectures start with ALB.


7.3 Listeners, Rules, Target Groups, and Health Checks

A load balancer is easier to understand when broken into its moving parts.

Listeners

A listener waits for traffic on a protocol and port, such as HTTPS on port 443.

This is where front-end traffic first enters the load balancer, and it is often where TLS handling, redirect behavior, and the first routing decision begin.

Rules

Rules decide how matching requests should be handled.

Examples:

  • send /api/* to the API target group
  • send admin.example.com to an admin service

Target groups

Target groups are the backend destinations.

Targets may include:

  • EC2 instances
  • IP addresses
  • Lambda functions in ALB-specific cases

Target groups are important because they let one load balancer route different request classes to different backend pools. That separation is useful for versioned services, admin paths, API tiers, and staged migrations.

Health checks

Health checks determine whether a target should receive traffic.

This is critical. A server that is technically running but returning errors should not stay in the active serving pool.

Health checks are one of the main ways AWS helps remove bad capacity before users feel the full effect.

The design of the health check matters as much as the existence of the health check. If it checks only whether a process is listening, it may continue sending traffic to an application that cannot reach its database, cannot load configuration, or is returning failures for real user requests.


7.4 Application Load Balancer

ALB is built for modern web applications.

It is a strong choice when you need:

  • path-based routing
  • host-based routing
  • central TLS termination
  • integration with multiple application target groups
  • HTTP-aware behavior and observability

ALB is also useful when one public endpoint needs to front multiple services. Instead of placing a separate public entry point in front of every service, you can centralize entry and steer traffic based on request attributes.

Typical pattern:

  • ALB in public subnets across multiple Availability Zones
  • application instances in private subnets
  • security groups allowing traffic from the ALB to the application tier only

This pattern improves security because application instances do not need direct internet exposure.

The main architectural trade-off is that HTTP-aware routing is powerful, but it also means the design now depends on well-defined request paths, headers, and service ownership boundaries. If routing rules grow without discipline, the edge layer becomes difficult to reason about.

ALB is often the default answer for web front ends, but not every workload is an HTTP application. That is where NLB becomes more relevant.


7.5 Network Load Balancer

NLB operates at Layer 4 and is optimized for high-performance network traffic.

It is useful when you need:

  • TCP or UDP handling
  • very high connection volumes
  • lower-level transport behavior
  • static IP style requirements

This makes NLB attractive for protocols that do not benefit from HTTP-aware routing or for systems that require transport-level performance characteristics more than application-layer features.

Compared with ALB, NLB is less focused on application-layer routing logic and more focused on efficient connection handling.

Architectural trade-off:

  • ALB gives richer HTTP routing features
  • NLB gives simpler, faster transport-level handling for the right use cases

Choose based on traffic type and routing needs, not habit.

In other words, start from the protocol and failure model of the workload, not from what was used in the last project.


7.6 Auto Scaling Groups

An Auto Scaling Group, or ASG, manages a fleet of instances as a group instead of as unrelated machines.

An ASG defines:

  • where instances launch
  • which launch template they use
  • the minimum number of instances
  • the desired number of instances
  • the maximum number of instances

The ASG can then:

  • launch new instances when capacity is too low
  • terminate instances when capacity is too high
  • replace unhealthy instances automatically

This replacement behavior is one of the most valuable features. It means the service can recover from individual host failure without requiring operators to rebuild the machine by hand.

This is a major shift in mindset. You stop managing server identity and start managing fleet behavior.

It also means instance readiness matters. If new instances take too long to bootstrap, register, warm caches, or become healthy, scaling may be technically happening while user experience still degrades.


7.7 Launch Templates and Capacity Boundaries

Auto Scaling needs a launch definition, and modern AWS practice uses launch templates for that purpose.

A launch template usually captures:

  • AMI choice
  • instance type
  • security groups
  • IAM role
  • storage configuration
  • user data and startup behavior

The goal is repeatability. If replacement instances do not launch with the same essential configuration, Auto Scaling becomes a source of drift instead of a source of resilience.

The min, desired, and max values in the ASG matter operationally:

  • minimum keeps a floor under your capacity
  • desired is what the group tries to maintain now
  • maximum prevents unbounded scale-out and surprise cost growth

These values also affect recovery behavior. If desired capacity is too low, the service may technically be healthy but unable to meet normal demand. If minimum capacity is set to one for a supposedly resilient service, then the service still has a single-instance baseline weakness.

If the maximum is set unrealistically high, a bad scaling trigger can produce a large bill. If it is set too low, legitimate demand spikes may still cause outages.

Capacity boundaries are a reliability control and a cost control at the same time.


7.8 Scaling Policies and Metrics

An ASG needs a reason to scale.

Common triggers include CloudWatch metrics such as:

  • average CPU utilization
  • request count per target
  • custom application metrics

Common policy styles include:

  • target tracking to keep a metric near a target value
  • step scaling for larger reactions at different thresholds
  • scheduled scaling for known predictable demand windows

There is always some delay in scaling. Metrics must rise, policies must evaluate, new instances must launch, bootstrap must finish, and health checks must pass.

Because of that delay, scaling policy design should consider lead time, not just steady-state utilization.

Good scaling depends on choosing a metric that matches real pressure.

Examples:

  • CPU may work for compute-bound services
  • request or concurrency metrics may be better for web traffic
  • queue depth may be better for worker fleets

If the metric does not reflect user impact, the group may scale too late or in the wrong direction.

This is why many mature systems combine multiple signals. For example, request volume might indicate incoming demand while response time or queue depth indicates that the service is no longer keeping up.


7.9 Multi-AZ Patterns and Safe Operations

The strongest baseline pattern is simple:

  • load balancer across multiple Availability Zones
  • Auto Scaling Group spanning multiple Availability Zones
  • private application instances behind the load balancer
  • health checks removing bad capacity automatically

This design helps with:

  • instance failure
  • localized Availability Zone failure
  • traffic surges
  • safer rolling updates when new instances can come online before old ones are removed

It also supports a safer deployment model. If the fleet is spread across multiple healthy targets, new versions can be introduced gradually instead of replacing the full serving pool in one risky step.

Solutions architect checkpoint:

  • Can the application survive losing one instance?
  • Can it survive losing one Availability Zone?
  • Are health checks meaningful, not just checking whether a process port is open?
  • Does scale-out improve throughput, or is the database or shared dependency the real bottleneck?
  • How long does a replacement instance take before it can serve production traffic safely?
  • Is session handling compatible with a distributed multi-instance model?

Auto Scaling is not magic. It only helps if the rest of the architecture can absorb additional instances usefully.

State is the common trap. If user session state, temporary files, or application assumptions are pinned to one server, adding more instances may spread traffic while still producing inconsistent behavior.


7.10 Common Mistakes

  • running a production application behind no load balancer at all
  • treating the load balancer as a dumb pass-through when routing and health policy are actually core design choices
  • using health checks that only prove the server is alive, not that the app is healthy
  • defining health checks so deeply that they become noisy and unstable under minor dependency issues
  • placing all instances in one Availability Zone
  • assuming Auto Scaling will fix a slow database or a locked shared dependency
  • choosing CPU-based scaling for workloads where CPU is not the real pressure signal
  • expecting new capacity to help immediately without accounting for bootstrap and registration delay
  • setting max capacity too low for demand spikes or too high for cost safety
  • putting instances in public subnets when a private tier behind a load balancer is safer
  • keeping session or application state tied to one instance in a fleet that is supposed to be replaceable
  • treating instance replacement as exceptional instead of normal fleet behavior

7.11 Hands-On Tasks

  1. Draw a two-Availability-Zone web application with an ALB and an Auto Scaling Group.
  2. Identify which components belong in public subnets and which belong in private subnets.
  3. Define one listener and two example rules for host-based or path-based routing.
  4. Describe a useful health check path for a web application and explain why a shallow check may be misleading.
  5. Choose min, desired, and max capacity values for a small production service and justify them.
  6. Pick one scaling metric for a web tier and explain why it reflects demand.
  7. Explain one workload where NLB is a better fit than ALB.
  8. Describe what happens if one instance becomes unhealthy while traffic is active.
  9. Trace how a new instance moves from launch to healthy traffic serving inside an Auto Scaling Group.
  10. Choose one health check that is too shallow and one that is too deep, then explain the failure risk in each case.
  11. Describe a workload where scaling on queue depth is better than scaling on CPU.
  12. Explain why a stateful session model can make horizontal scaling harder even when the infrastructure layer is correct.

7.12 Recap

  • Load balancers spread traffic and help isolate users from individual server failures.
  • ALB is usually the default for HTTP and HTTPS applications, while NLB fits lower-level transport needs.
  • Target groups, listeners, rules, and health checks together define how traffic is classified and where it goes.
  • Auto Scaling Groups manage fleets, not individual pets.
  • Launch templates define consistent replacement behavior, and instance readiness affects how useful scaling really is.
  • Scaling policies only work well when the chosen metrics match real workload pressure and when scale-out delay is accounted for.
  • Multi-AZ load balancing and fleet replacement are baseline reliability patterns, not advanced extras.

Next: Route 53 and DNS Routing.

8: Route 53 and DNS Routing

The Domain Name System (DNS) is what turns names people use into destinations computers can reach. Amazon Route 53 is AWS's DNS service, and it plays a major role in how users find your applications and how traffic is directed during normal operation or failure.

This chapter explains why DNS is more than a simple naming tool. You will learn how hosted zones, records, alias targets, health checks, and routing policies are used to send users to the right endpoint with the right balance of speed, availability, and control.


8.1 Why DNS Matters

Users do not type IP addresses into applications. They use names.

That makes DNS a control plane for availability, latency, and change management.

When DNS is designed well:

  • users reach the right endpoint
  • service migrations become easier
  • failover can happen with less manual intervention
  • infrastructure can change without exposing raw addressing details

When DNS is designed badly:

  • traffic may route to the wrong place
  • failover expectations may be unrealistic
  • cached records can keep users on unhealthy paths longer than expected

For a solutions architect, DNS is not just naming. It is traffic steering under real-world caching behavior.

That last part matters because DNS is indirect control. You publish answers, but recursive resolvers, client caches, and applications decide when those answers are re-queried. Good DNS design starts with that limitation rather than assuming immediate global consistency.


8.2 What Route 53 Does

Amazon Route 53 is AWS's managed DNS service.

It handles several core functions:

  • domain registration in supported cases
  • authoritative DNS hosting through hosted zones
  • health checks for selected endpoints
  • routing policies that influence how answers are returned

Route 53 does not replace the rest of the application stack. It answers naming and routing questions at the DNS layer, but it does not ensure that the underlying workload is correctly deployed, consistent across regions, or ready for production traffic.

Route 53 is global in scope, but it usually points users toward regional resources such as load balancers, EC2-backed endpoints, or S3-based websites.

That means you need to distinguish between the global control plane and the regional systems that actually serve the traffic.


8.3 Hosted Zones and Delegation

A hosted zone stores the DNS records for a domain or subdomain.

The two main hosted zone types are:

  • public hosted zones for internet-resolvable names
  • private hosted zones for names used inside one or more VPCs

This distinction matters operationally. A public hosted zone controls what the internet sees. A private hosted zone controls what selected VPC environments resolve internally. They may use similar names, but they serve different audiences and trust boundaries.

If you manage example.com, a public hosted zone can contain records such as:

  • www.example.com
  • api.example.com
  • admin.example.com

Delegation matters because DNS is hierarchical. If you want Route 53 to answer for your domain, your registrar must point the domain's name server records to the Route 53 hosted zone name servers.

That means there are two separate configuration layers:

  • the hosted zone and its records inside Route 53
  • the parent delegation that tells resolvers Route 53 is authoritative

If delegation is wrong, the records inside Route 53 can be perfectly configured and still never be used.

This is one of the most common beginner problems in DNS work. Teams edit the child zone correctly and then troubleshoot the wrong layer because the parent still points somewhere else.


8.4 Record Types and Alias Records

Route 53 supports standard DNS record types such as:

  • A and AAAA for IPv4 and IPv6 answers
  • CNAME for canonical name mappings
  • MX for mail routing
  • TXT for verification and policy data

AWS-specific design often centers on alias records.

Alias records let Route 53 point a name at certain AWS resources such as:

  • Application Load Balancers
  • Network Load Balancers
  • CloudFront distributions
  • S3 static website endpoints in supported patterns

Why alias matters:

  • it works at the zone apex where a plain CNAME would be problematic
  • it hides endpoint address changes behind a stable name
  • it fits AWS-managed targets cleanly

That apex behavior is especially important for names such as example.com, where you often want the root domain to point to an AWS-managed entry point without violating normal DNS constraints.

For many AWS architectures, the public entry point is an alias record pointing to a load balancer.

Architecturally, that gives you a stable DNS name even when the underlying AWS-managed target changes over time.


8.5 Public and Private DNS

Public DNS answers requests from the public internet. Private DNS answers requests only from associated VPC environments.

Private hosted zones are useful for internal service discovery patterns such as:

  • api.internal.example.local
  • payments.service.prod

This separation is important because internal names and public names often have different security and routing goals.

Examples:

  • public users resolve app.example.com to an internet-facing ALB
  • internal application components resolve db.internal.example.com to a private endpoint

Some architectures also use the same service concept in both public and private namespaces, but they should still be explicit about which clients resolve which records. If that separation is informal instead of designed, troubleshooting becomes difficult and security boundaries become unclear.

Do not mix internal and public naming casually. Clear boundaries reduce both confusion and accidental exposure.


8.6 Time to Live, Caching, and Propagation Reality

DNS answers are cached.

That means changes are not seen everywhere immediately, even when Route 53 updates quickly.

The record's time to live, or TTL, influences how long resolvers may cache the answer before asking again.

Implications:

  • shorter TTLs can make changes visible sooner, but they increase query frequency
  • longer TTLs reduce query churn, but they slow cutovers and failover responsiveness

This is why operational cutovers often begin before the actual migration event. Teams sometimes lower TTLs ahead of a planned DNS change so caches age out faster when the new answer is published.

Important nuance:

  • DNS is not an instant failover mechanism
  • client resolvers, intermediary caches, and application behavior all affect when users observe a change
  • some clients or networks may behave less predictably than the nominal TTL suggests

Architects should set TTLs based on the expected rate of change and the acceptable failover lag, not by habit.


8.7 Health Checks and DNS Failover

Route 53 health checks let DNS answers depend on endpoint health.

This is useful for:

  • active-passive regional failover
  • validating whether a public endpoint should stay in rotation
  • routing away from unhealthy application entry points

However, health checks have limits:

  • they observe from the outside, not from inside every client network path
  • they cannot override cached answers already held by resolvers
  • they only help if the failover target is actually ready to serve traffic

They also depend on the quality of the health signal. If the check only verifies that a front-end endpoint answers TCP or HTTP, it may miss application-level failure deeper in the stack.

DNS failover is therefore part of a broader recovery design, not a complete recovery design by itself.

If the standby environment is stale, misconfigured, or overloaded, DNS can successfully route users to failure faster.

That is why failover planning must include data replication, dependency readiness, capacity validation, and recovery testing, not only a routing rule.


8.8 Routing Policies and How to Choose

Route 53 supports multiple routing policies. The important question is when to use each one.

Simple routing

Use when a single healthy endpoint is enough and no special distribution behavior is needed.

Weighted routing

Use when you want controlled traffic splitting.

Good for:

  • gradual migrations
  • canary-style traffic shifts
  • reducing traffic to an older endpoint without cutting it off instantly

Weighted routing is useful because it lets you change traffic allocation deliberately instead of treating migration as a single irreversible cut.

Latency-based routing

Use when users in different geographies should be directed to the region that gives the lowest latency among the configured healthy options.

This improves user experience only if the regional backends are actually prepared to serve the traffic they receive. Lower-latency routing does not solve data locality or cross-region consistency by itself.

Failover routing

Use when you have a primary endpoint and a standby endpoint for recovery.

This is usually the clearest choice when the architecture has a deliberate primary region and a recovery region with different operational roles.

Other specialized policies exist, but these are enough to build a strong mental model early.

The decision should be driven by workload behavior:

  • do you need controlled distribution, lower latency, or explicit standby behavior?

8.9 DNS Design Patterns for AWS Architectures

Common AWS patterns include:

  • app.example.com aliasing to an ALB for a regional web application
  • api.example.com using weighted routing during a blue-green migration
  • latency-based routing across multiple regional entry points
  • failover routing from a primary region to a warm standby region

Another useful mental model is to decide whether DNS is being used for:

  • stable naming
  • traffic distribution
  • migration control
  • regional recovery

One record can sometimes serve more than one purpose, but the design is clearer when you know the primary goal.

Solutions architect checkpoint:

  • Is DNS being used to hide infrastructure changes behind a stable name?
  • Are TTL values aligned with expected failover or migration speed?
  • Does the health-check strategy reflect real application health?
  • If multiple regions are used, are data consistency and backend readiness also solved, or only the routing layer?
  • Is the parent delegation correct, or is the problem outside the hosted zone itself?
  • Are public and private consumers intentionally separated?

DNS should support the architecture, not pretend to replace the rest of it.


8.10 Common Mistakes

  • assuming DNS changes are visible to all users immediately
  • confusing hosted zone creation with successful registrar delegation
  • lowering or raising TTLs without understanding how that affects cutover behavior
  • using public DNS names for internal-only services without clear reason
  • treating a CNAME and an alias record as interchangeable in every case
  • assuming DNS health checks prove the full application stack is healthy
  • relying on DNS failover without validating the standby environment
  • choosing routing policies without understanding the user traffic pattern
  • setting TTLs without considering operational cutover and cache behavior
  • trying to solve application consistency problems only at the DNS layer
  • forgetting that load balancers and other AWS targets may be regional even when Route 53 is global

8.11 Hands-On Tasks

  1. Define a public hosted zone layout for example.com with www, api, and admin subdomains.
  2. Explain which of those names should probably point to a load balancer.
  3. Describe when you would use an alias record instead of a standard CNAME.
  4. Design a private hosted zone for internal service names used only inside a VPC.
  5. Choose TTL values for a stable production website and for a service you expect to migrate soon, then explain the trade-off.
  6. Describe a primary and standby regional design that uses Route 53 failover routing.
  7. Explain why health checks alone do not guarantee a successful recovery.
  8. Choose between simple, weighted, latency-based, and failover routing for four different example scenarios.
  9. Write down the two layers you would verify when a Route 53 hosted zone looks correct but the domain still resolves elsewhere.
  10. Describe when a zone apex alias record is necessary and why a normal CNAME is not the right choice there.
  11. Plan a blue-green migration using weighted routing and explain how TTL affects the rollback story.
  12. Describe one case where DNS should point to a stable application entry point and one case where internal-only service names should stay private.

8.12 Recap

  • Route 53 is AWS's managed DNS service and a major traffic steering layer.
  • Hosted zones define where Route 53 is authoritative, but delegation must also be correct.
  • Alias records are central to many AWS architectures because they integrate cleanly with AWS-managed targets and work well at the zone apex.
  • Public and private DNS serve different audiences and should stay intentionally separated.
  • TTL and caching behavior shape how fast changes and failovers are observed, so DNS cutovers must be planned rather than assumed.
  • Health checks and routing policies support availability goals, but they do not replace a real recovery design.
  • DNS is most effective when it works with sound regional, application, and data architecture decisions.

Next: S3 Object Storage.

9: S3 Object Storage

Amazon Simple Storage Service (Amazon S3) is AWS object storage for files such as images, logs, backups, documents, and static website assets. It is widely used because it is durable, highly scalable, and easy to connect to from many other AWS services.

This chapter explains how S3 stores data as objects inside buckets and why that model matters. You will learn how teams use storage classes, versioning, lifecycle rules, and access controls to keep data available, secure, and cost-aware in production.


9.1 Why S3 Matters

Amazon Simple Storage Service, or Amazon S3, is one of the foundational AWS services.

It appears in many architectures because a large percentage of cloud workloads need durable storage for files rather than block devices or relational rows.

Typical use cases include:

  • storing application assets such as images, documents, and uploads
  • hosting static websites or frontend bundles
  • keeping logs, backups, and exported datasets
  • serving as a landing zone for analytical and event-driven workflows

S3 matters because it gives you highly durable object storage without managing disks, RAID, file servers, or capacity planning the way you would in traditional environments.

But S3 is also easy to misuse. Weak bucket policies, poor lifecycle choices, and confusion about public access are common sources of security and cost problems.


9.2 The Core S3 Model: Buckets and Objects

S3 is an object storage service.

Its core building blocks are:

  • buckets, which are the top-level containers
  • objects, which are the stored items inside buckets
  • object keys, which are the names used to identify those objects

An object is not a block device and not a file-system-mounted disk. It is a stored data item addressed by a key.

That difference matters architecturally.

With S3:

  • you do not mount it like EBS in the normal sense
  • you retrieve or write objects through APIs and service integrations
  • you design around object operations, prefixes, metadata, and lifecycle rules

This is why S3 fits static assets, backups, media, and data lake patterns well, but it is not a drop-in replacement for a low-latency transactional file system.


9.3 Durability, Availability, and Regional Design

S3 is designed for very high durability.

That durability is one of the main reasons it is trusted for backups, archives, and critical application objects. AWS achieves this through redundant storage design within a region.

Architects should still understand the scope of that design:

  • S3 buckets are created in a chosen region
  • object durability is delivered within that regional service model
  • regional resilience is strong, but cross-region disaster recovery may still require deliberate replication or backup patterns

This is the same design lesson seen in earlier chapters: strong regional durability does not automatically mean multi-region recovery.

For many workloads, one region is enough. For higher recovery requirements, you plan replication and restoration intentionally rather than assuming the service choice alone solved the problem.


9.4 Storage Classes and How to Choose

Not all stored data needs the same cost and retrieval profile.

S3 storage classes exist to match storage behavior to access patterns.

At a high level:

  • frequently accessed data should stay in storage classes optimized for regular retrieval
  • infrequently accessed data can move into lower-cost options with different retrieval or availability characteristics
  • archival data can move into even cheaper tiers when retrieval speed is less important

The design question is not which storage class is cheapest in isolation. The real question is how often the object is read, how quickly it must be restored, and what retrieval costs or delays are acceptable.

Examples:

  • frontend assets used continuously are poor candidates for archive-oriented storage
  • backup data that is rarely needed may be a strong candidate for lower-cost, colder storage

Choosing storage classes well is one of the easiest ways to control S3 cost without weakening the architecture.


9.5 Versioning, Lifecycle Rules, and Data Retention

S3 versioning protects against accidental overwrites and deletions by keeping object versions rather than replacing history silently.

This is especially valuable for:

  • critical application assets
  • compliance-relevant data
  • backup repositories
  • environments where human error is a realistic threat

Versioning is not enough by itself. Without lifecycle rules, buckets can accumulate storage endlessly.

Lifecycle rules help manage:

  • transition between storage classes over time
  • expiration of old versions or temporary objects
  • cleanup of incomplete or obsolete data patterns

Retention design matters because S3 makes it easy to keep everything. Keeping everything forever is rarely the right answer operationally or financially.

Teams should define how long current objects, old versions, logs, uploads, and backups need to stay available.


9.6 Security Model: Bucket Policies, IAM, and Public Access

S3 security is one of the most important beginner topics because misconfiguration here can expose data publicly.

Access control can involve:

  • IAM identities and policies
  • bucket policies
  • access points in more advanced patterns
  • block public access settings

The safest default is that buckets are private unless a specific public-serving use case is designed intentionally.

This matters because object storage often contains more than static files. It may contain logs, reports, exports, documents, or application data that should never be public.

Block public access settings are especially important. They help prevent accidental exposure caused by permissive policies or object ACL patterns.

Architecturally, you should assume S3 buckets are security boundaries that require explicit review, not passive storage folders.


9.7 Static Website Hosting and Content Delivery Patterns

S3 can host static website content, which makes it useful for frontend assets such as HTML, CSS, JavaScript, images, and downloadable files.

This is a good fit when:

  • the site is static or frontend-heavy
  • dynamic behavior happens through APIs rather than server-side page rendering on the storage layer
  • you want durable, simple hosting for web assets

However, production hosting usually needs more than a public bucket.

A stronger pattern is often:

  • store the static assets in S3
  • use CloudFront in front of S3 for caching, TLS termination, and better edge delivery
  • use Route 53 for DNS

This pattern improves performance, centralizes public delivery behavior, and reduces the need to expose raw S3 website endpoints directly.


9.8 Data Access Patterns and Performance Thinking

S3 performs best when used according to object-storage patterns rather than file-system habits.

Useful design habits include:

  • storing objects with clear naming schemes and prefixes
  • separating workloads by bucket purpose or controlled prefixes where appropriate
  • understanding whether workloads are read-heavy, write-heavy, or archive-heavy
  • avoiding application designs that expect shared file locking or low-latency random block writes

This is where many architecture mistakes begin. Teams sometimes try to make S3 behave like a mounted application file system, which leads to awkward code and incorrect performance expectations.

If the workload needs block semantics or shared file-system behavior, a different storage service is usually the right answer. That is exactly why the next chapter covers EBS and EFS separately.


9.9 Architect Decision Patterns for S3

When reviewing a design that includes S3, ask:

  • Is object storage the correct model for this data?
  • Should the bucket ever be public, or should delivery happen through CloudFront?
  • Does the workload need versioning?
  • What lifecycle rules keep cost under control?
  • Does the bucket need cross-region replication or only strong regional durability?
  • Who can read, write, delete, or change bucket policies?

These questions expose whether S3 is being used deliberately or simply because it is easy to start with.

Strong S3 design is usually simple on the surface and very explicit underneath: private by default, lifecycle-aware, and clear about who can access what.


9.10 Common Mistakes

  • treating S3 like a mounted file system instead of object storage
  • making buckets or objects public without a deliberate public-serving design
  • skipping block public access protections
  • enabling versioning without lifecycle rules and letting storage grow indefinitely
  • choosing storage classes without understanding retrieval behavior and cost
  • assuming strong regional durability is the same as a multi-region recovery plan
  • using one bucket for unrelated workloads with unclear ownership and access boundaries
  • storing sensitive exports or logs in S3 without reviewing bucket policies and encryption settings

9.11 Hands-On Tasks

  1. Explain the difference between object storage and block storage in your own words.
  2. Design an S3 bucket layout for a small web application with static assets, user uploads, and access logs.
  3. Decide which buckets should be private and which, if any, should be exposed through a public delivery pattern.
  4. Define a lifecycle rule for old application logs and another for temporary uploads.
  5. Describe when versioning is important and when it may create unnecessary cost without a clear retention plan.

9.12 Recap

S3 is AWS's core object storage service and is used for static assets, uploads, logs, backups, and analytical datasets. Its main strengths are durability, scale, and service integrations, but it needs deliberate design around access control, lifecycle management, versioning, and public delivery. Strong S3 usage starts with the right storage model and a clear security and retention strategy.

Next: 10: EBS and EFS

10: EBS and EFS

Some workloads need storage that looks like a disk, and others need a shared file system that many machines can use at the same time. Amazon Elastic Block Store (Amazon EBS) and Amazon Elastic File System (Amazon EFS) solve these two different problems.

This chapter shows when block storage is the right fit and when shared file storage makes more sense. You will learn how these services are used with Amazon Elastic Compute Cloud (Amazon EC2), and why performance, availability, persistence, and cost all affect the design choice.


10.1 Why EBS and EFS Matter

Not all persistent data belongs in object storage.

Many workloads need:

  • a disk attached to a compute instance
  • a file system shared by multiple instances
  • low-latency storage for operating systems, databases, or application state

That is where Amazon Elastic Block Store, or EBS, and Amazon Elastic File System, or EFS, become relevant.

These services solve different storage problems:

  • EBS provides block storage, usually attached to one EC2 instance at a time in normal designs
  • EFS provides a managed shared file system that can be mounted across multiple compute resources

Choosing between them is not a feature comparison exercise. It is a workload-shape decision.


10.2 Block Storage Versus Shared File Storage

Before looking at the services themselves, clarify the storage models.

Block storage

Block storage behaves like a raw disk presented to a machine. The operating system formats and mounts it.

This is useful when:

  • the workload expects local-disk semantics
  • an operating system or database needs a dedicated volume
  • low-latency instance-attached storage behavior matters

Shared file storage

Shared file storage presents a file system that multiple clients can mount.

This is useful when:

  • multiple servers need access to the same files
  • applications rely on standard file-system directory structures
  • you want managed elasticity without operating your own NFS infrastructure

This distinction is the core decision boundary between EBS and EFS.


10.3 Amazon EBS Fundamentals

Amazon EBS is persistent block storage for EC2-based workloads.

Common uses include:

  • root volumes for EC2 instances
  • database storage for self-managed databases running on EC2
  • application data volumes that need low-latency block access
  • boot disks and attached persistent volumes for traditional server patterns

EBS is useful because it separates compute lifetime from storage lifetime. An EC2 instance can stop, fail, or be replaced while the volume persists according to your design.

That said, EBS is still part of an Availability Zone scoped model. Architects need to understand placement and recovery boundaries rather than assuming a volume behaves like region-wide shared storage.


10.4 EBS Volume Types, Performance, and Design Trade-Offs

EBS is not one uniform volume type.

Different workloads need different balances of:

  • input and output operations per second, or IOPS
  • throughput
  • latency
  • cost

The architect's question is not just, "Which EBS option is fastest?" The better question is, "What performance profile does the workload require, and what is the cost of overprovisioning or underprovisioning it?"

For example:

  • a small general-purpose application volume may not need high-end performance tuning
  • a busy self-managed database on EC2 may care deeply about latency and sustained IOPS behavior

Storage performance should be based on measured workload needs, not intuition or maximum specifications.


10.5 Snapshots, Backup, and Recovery for EBS

EBS volumes are persistent, but persistence alone is not a backup strategy.

Snapshots provide a way to protect and recover volume data over time. They are essential for:

  • backup and restore processes
  • golden image or baseline environment creation
  • recovery after accidental deletion or corruption
  • copying data into new environments or regions as part of broader recovery planning

Architecturally, snapshot strategy should answer:

  • how often data changes
  • how much loss is acceptable
  • how quickly a volume or server must be restored
  • whether recovery must stay within one region or cross regions

EBS is strong for persistent instance storage, but it still needs the same backup discipline discussed later in the disaster recovery chapter.


10.6 Amazon EFS Fundamentals

Amazon EFS is a managed elastic file system designed for shared access.

It is useful when multiple compute resources need to mount the same file system concurrently.

Typical use cases include:

  • shared application content
  • content management systems
  • container workloads that need a shared filesystem layer
  • environments that historically would have used an NFS server

EFS reduces the burden of managing your own shared file storage infrastructure. You do not need to patch or scale an NFS appliance yourself.

But EFS is not the right answer for every workload. If a workload needs low-latency single-instance block semantics, EBS is the closer fit.


10.7 Availability, Mount Targets, and Shared Access Patterns

EFS is designed for regional use with access from resources in connected network environments through mount targets.

The important architectural point is that EFS provides shared file access, not merely persistent storage.

That makes it attractive when:

  • several application nodes need consistent access to the same files
  • a fleet may scale in and out but should see one common filesystem view
  • the workload benefits from managed elasticity rather than fixed-capacity file servers

Shared access also changes the operational model. You need to think about:

  • how applications coordinate file changes
  • whether the workload assumes local-disk performance that EFS is not designed to provide
  • network access and security group design for mounted clients

Shared storage solves one class of problems while introducing concurrency and application-behavior considerations of its own.


10.8 EBS Versus EFS: How to Choose

Choose EBS when:

  • the storage belongs closely to one EC2 instance or one workload node at a time
  • block-device semantics are required
  • the application expects a local disk or database-style volume pattern
  • you want direct control over the volume-performance profile

Choose EFS when:

  • multiple instances or containers need to mount the same file system
  • the workload expects shared directories rather than isolated local disks
  • you want managed file-system scaling instead of running your own shared storage server

Avoid forcing one model to imitate the other. If the workload clearly wants block storage, shared file storage will often feel slow or awkward. If the workload clearly needs shared files, per-instance EBS volumes will create synchronization pain.


10.9 Architect Decision Patterns and Operational Concerns

When reviewing storage choices, ask:

  • Does the application need object, block, or shared file storage?
  • Is the storage tied to a single node, or must it be shared across many nodes?
  • What are the backup and restore expectations?
  • What performance characteristics matter most?
  • Does the workload scale through stateless compute with external storage, or is state tightly bound to one machine?
  • Are security groups, encryption, and access controls aligned with how the storage is mounted or attached?

These questions usually reveal whether the storage choice supports the application cleanly or whether it is compensating for an unclear application design.


10.10 Common Mistakes

  • choosing EBS when several servers really need a shared file system
  • choosing EFS for workloads that actually need single-node block-device behavior
  • assuming persistent storage means backups are unnecessary
  • sizing storage performance by guesswork rather than workload observation
  • forgetting that EBS volumes are Availability Zone scoped in their normal operating model
  • attaching storage securely but failing to define retention, snapshot, or restore procedures
  • mounting shared storage without thinking through file coordination and application concurrency behavior
  • using shared storage as a shortcut instead of making stateless components simpler where possible

10.11 Hands-On Tasks

  1. Compare a self-managed database on EC2 with a shared content repository used by multiple application nodes, and choose EBS or EFS for each.
  2. Explain why S3 is not the right replacement for an instance boot disk.
  3. Describe an EBS snapshot strategy for a small production EC2-based application.
  4. List the application behaviors that make EFS a better fit than multiple separate EBS volumes.
  5. Identify one workload where the correct answer is neither EBS nor EFS because object storage is a better model.

10.12 Recap

EBS provides persistent block storage for EC2-based workloads, while EFS provides a managed shared file system for workloads that need concurrent file access. The correct choice depends on storage semantics, performance expectations, sharing needs, and recovery requirements. Strong storage design begins by understanding what the application actually needs rather than treating all persistence as the same problem.

Next: 11: RDS and Aurora

11: RDS and Aurora

Relational databases are still a common choice for applications that need structured data, transactions, and SQL. Amazon Relational Database Service (Amazon RDS) and Amazon Aurora let AWS manage much of the operational work, such as backups, patching, and failover, while you still make key design decisions.

This chapter explains where managed relational databases fit in AWS architecture. You will learn how they differ from running a database yourself on Amazon Elastic Compute Cloud (Amazon EC2), and why backups, read scaling, and Multi-Availability Zone design matter in production.


11.1 Why Managed Relational Databases Matter

Many business systems still depend on relational data.

They need:

  • structured schemas
  • transactional integrity
  • SQL querying
  • strong consistency for core workflows

You can run a relational database on EC2, but that puts responsibility for patching, backups, availability design, monitoring, and recovery on your team.

Amazon Relational Database Service, or Amazon RDS, reduces much of that operational burden by providing managed database infrastructure for several relational engines.

Amazon Aurora goes further with an AWS-built relational engine designed for cloud operational patterns and higher managed resilience characteristics.

The value is not that AWS makes databases simple. The value is that AWS takes over a meaningful part of the infrastructure operations so teams can focus more on schema, queries, scaling patterns, and application behavior.


11.2 What RDS Provides

Amazon RDS is a managed service for relational database engines.

At a practical level, it helps with:

  • instance provisioning
  • automated backups
  • patching windows and maintenance operations
  • monitoring and service integration
  • high-availability options such as Multi-AZ deployments

RDS reduces operational work, but it does not remove design responsibility.

You still need to decide:

  • which engine fits the workload
  • how large the database should be
  • how backups and retention should work
  • which applications and users can access it
  • whether the workload needs read scaling or higher availability

Managed does not mean architecture-free.


11.3 Aurora and How It Differs

Aurora is part of the RDS family but is architecturally distinct enough to think about separately.

It is designed to provide relational database behavior with AWS-managed storage and high-availability patterns tuned for cloud deployments.

At a high level, Aurora is often chosen when teams want:

  • managed relational behavior with stronger built-in resilience patterns
  • simpler scaling patterns for some read-heavy designs
  • tighter AWS-managed operational characteristics than a traditional self-managed engine style

The important lesson for beginners is not to memorize internal implementation details. It is to recognize that "RDS" can mean both traditional managed relational engines and Aurora, and the trade-offs are not identical.

Aurora is not always automatically the best choice. It is a design option whose strengths need to match the workload.


11.4 Single-AZ, Multi-AZ, and Failure Thinking

Relational databases are often critical-path systems. Their failure can stop the application.

That is why availability design matters so much.

Single-instance database deployment may be acceptable for development or low-risk internal use, but production systems often need stronger failure tolerance.

Multi-AZ design improves resilience against infrastructure failure inside a region by keeping the database service ready for failover across Availability Zones.

This is not the same as read scaling.

Important distinction:

  • Multi-AZ is mainly about availability and failover
  • read replicas are mainly about distributing read load or supporting read-heavy patterns

Teams often confuse these. A read replica does not automatically provide the same operational guarantee as a high-availability failover design.


11.5 Backups, Snapshots, and Recovery Strategy

Managed databases still require backup planning.

RDS and Aurora support automated backups and manual snapshots, but the architectural questions remain:

  • how long should backups be retained
  • how much data loss is acceptable
  • how quickly must recovery happen
  • does the workload need cross-region recovery planning

Backups support recovery from more than hardware failure. They also matter for:

  • accidental deletion
  • application bugs that corrupt data
  • rollback or environment cloning needs
  • security incidents that require known-good recovery points

The presence of automated backups is useful, but it does not replace restore testing or disaster recovery design.


11.6 Read Scaling and Replica Patterns

Many relational workloads eventually face a read-versus-write imbalance.

If the primary database handles both writes and all read traffic, application growth can create pressure even when write volume is moderate.

Read replicas help distribute read load for workloads such as:

  • reporting queries
  • read-heavy APIs
  • analytics-style queries that should not burden the primary

But replicas come with architectural consequences:

  • applications must know which traffic is safe to read from replicas
  • replication lag may matter for freshness-sensitive reads
  • some user journeys must still read from the primary if immediate consistency is required

That means read scaling is not only a database feature. It is an application-consistency decision.


11.7 Security and Access Control

A managed database is still a sensitive system.

Security design should cover:

  • network placement inside appropriate subnets
  • security groups that allow only intended clients
  • encryption at rest and in transit where required
  • credential handling through Secrets Manager or equivalent secure patterns
  • least-privilege database users and application roles

One of the most common mistakes is focusing on engine setup while leaving access design too broad.

Databases should not be reachable by everything inside the VPC by default. Access boundaries should reflect the application architecture and trust model.


11.8 Operational Trade-Offs: Self-Managed on EC2 Versus RDS or Aurora

Managed services always involve trade-offs.

Running a database on EC2 may offer more low-level control, but it also means your team owns more of:

  • patching
  • backup orchestration
  • failover engineering
  • OS-level hardening
  • monitoring and restoration workflows

RDS and Aurora reduce that operational surface significantly.

For most teams, that trade is beneficial. The exception is usually when a workload has specific engine-level or OS-level requirements that the managed model does not fit.

Architects should default to managed relational services unless there is a concrete reason not to.


11.9 Solutions Architect Review Questions

When reviewing a relational database design, ask:

  • Does the workload truly need a relational database?
  • What is the availability requirement: development convenience, production baseline, or high-criticality failover posture?
  • Will the workload need read scaling, and how will the application handle replica consistency?
  • What backup retention and restore expectations exist?
  • Are credentials, subnet placement, and security groups properly constrained?
  • Is there any reason this workload should be self-managed instead of using RDS or Aurora?

These questions keep the service choice tied to workload behavior rather than habit.


11.10 Common Mistakes

  • assuming a managed database removes the need for backup and recovery planning
  • confusing Multi-AZ with read scaling
  • sending freshness-sensitive reads to replicas without thinking through replication lag
  • exposing the database too broadly at the network layer
  • hard-coding database credentials into application code or local files
  • choosing self-managed databases on EC2 without a strong operational reason
  • treating relational storage as the default answer even when the access pattern may fit another database model better
  • ignoring restore testing while assuming backups are sufficient

11.11 Hands-On Tasks

  1. Explain the difference between Multi-AZ failover and read replicas.
  2. Compare a small internal app database with a customer-facing production transaction database and describe the likely availability posture for each.
  3. Define a backup retention strategy for a relational database that supports daily business operations.
  4. List the application reads that could safely use replicas and the reads that should stay on the primary.
  5. Describe one case where running a database on EC2 might be justified and why it is usually not the default choice.

11.12 Recap

RDS and Aurora provide managed relational database options that reduce operational burden while preserving the core strengths of relational systems. Strong design still requires deliberate decisions about availability, backups, read scaling, credentials, and network access. Managed databases simplify operations, but they do not remove the need for sound architectural judgment.

Next: 12: DynamoDB

12: DynamoDB

Amazon DynamoDB is a managed NoSQL database built for very high scale and low-latency access. It is useful when applications need fast, predictable performance without managing database servers.

This chapter introduces the DynamoDB design mindset, which is different from traditional relational modeling. You will learn why partition keys, sort keys, and access patterns shape the data model, and how that affects application design, scaling, and operational simplicity.


12.1 Why DynamoDB Matters

Not every workload fits a relational database.

Some systems need:

  • very high scale with low operational overhead
  • predictable low-latency access patterns
  • simple key-based lookups and event-driven integration
  • flexible schemas aligned to known application access needs

Amazon DynamoDB is AWS's fully managed NoSQL database service built for those kinds of workloads.

DynamoDB matters because it changes the design conversation. Instead of starting from normalized tables and joins, you start from access patterns: what the application needs to read and write, how frequently, and with what latency expectations.

This is a powerful model, but it requires discipline. Poor DynamoDB design usually begins when teams treat it like a relational database with different syntax.


12.2 The Access-Pattern-First Mindset

The most important DynamoDB concept is that schema design follows access patterns.

That means you ask:

  • What exact items will the application retrieve most often?
  • By which keys or query shapes?
  • What write patterns will occur?
  • What query flexibility is truly required?

In relational systems, you can often model the data first and rely on joins or ad hoc queries later. In DynamoDB, that approach usually creates inefficient or awkward access.

The design process is therefore closer to API design than traditional database normalization. You shape items so the most important reads and writes are efficient and predictable.


12.3 Tables, Items, and Primary Keys

DynamoDB stores data in tables containing items.

Each item is a set of attributes, but the critical design element is the primary key.

Primary key patterns include:

  • a partition key alone for simple key distribution and lookup
  • a partition key plus sort key for grouped item collections and ordered retrieval within a partition

The partition key matters because it influences how data is distributed and how access scales.

The sort key matters because it allows multiple related items to be modeled together and queried in ordered or filtered ways within the same partition.

These are not minor implementation details. They are the center of DynamoDB data modeling.


12.4 Partitioning, Scale, and Hot Keys

DynamoDB scales by partitioning data behind the scenes. That is why key choice is so important.

If traffic concentrates too heavily on one partition key value, the workload may create a hot partition or hot key problem.

This matters because overall table scale does not help much if the access pattern is concentrated on a small part of the key space.

Good designs spread traffic naturally across partition keys where the workload allows it.

Architects should watch for patterns such as:

  • timestamp-heavy writes that all target the same key shape
  • globally popular items that receive disproportionate traffic
  • designs where many unrelated operations collapse onto one partition key

DynamoDB can scale very well, but only when the key model supports that scale.


12.5 Query Patterns, Secondary Indexes, and Data Modeling Trade-Offs

Applications often need more than one way to retrieve data.

DynamoDB supports additional query flexibility through secondary indexes, but indexes should be created deliberately.

The design question is not, "How do I recreate arbitrary SQL-style querying?" The better question is, "Which additional access patterns are important enough to justify dedicated index paths?"

Secondary indexes are powerful, but they bring trade-offs:

  • additional write overhead
  • more design complexity
  • more operational surface to understand and monitor

Strong DynamoDB design often denormalizes data intentionally to support the important reads directly rather than relying on many generic query paths.

That can feel unusual to teams coming from relational backgrounds, but it is often the correct trade in this model.


12.6 Throughput Modes and Capacity Thinking

DynamoDB capacity planning is about read and write demand, traffic variability, and cost.

At a practical level, teams choose between models that reflect:

  • stable versus bursty traffic
  • the desire for simpler scaling behavior versus tighter predictability and cost control
  • how much operational attention the table should require

The core lesson is that capacity is not only a billing topic. It reflects workload shape.

Architects should consider:

  • steady traffic that may be easy to plan
  • sudden spikes that need automatic responsiveness
  • background jobs that can create intense write bursts

If the application traffic model is poorly understood, the DynamoDB cost and performance model will usually be misunderstood too.


12.7 Consistency, Events, and Application Behavior

DynamoDB is often used in event-driven architectures, session stores, high-scale APIs, and service-owned data models.

That means application behavior matters as much as table design.

Important questions include:

  • which reads require the freshest possible data
  • whether the workload can tolerate eventual consistency in some cases
  • how item updates interact with asynchronous events or retries
  • whether writes are idempotent when requests are replayed

DynamoDB works well with modern decoupled architectures, but only if the application logic is designed for the database semantics rather than against them.


12.8 Security and Operational Simplicity

DynamoDB removes many infrastructure tasks associated with self-managed databases.

You do not manage servers, disks, patches, or conventional replication infrastructure in the same way.

But operational simplicity is not the same as zero responsibility.

You still need to design:

  • IAM access boundaries
  • encryption and secret handling for clients and dependent services
  • alarms for throttling, latency, and error behavior
  • backup and restore expectations
  • data model changes over time

One of the service's strengths is that it lets teams focus more on data access design and less on infrastructure maintenance. That strength is only realized when the data model is sound.


12.9 Solutions Architect Review Questions

When reviewing a DynamoDB design, ask:

  • What are the exact read and write access patterns?
  • Is the partition key likely to distribute traffic well?
  • Do any planned queries require secondary indexes, and are those indexes justified?
  • Which reads require fresh data and which can tolerate looser consistency?
  • Is the team using DynamoDB because it fits the workload or simply to avoid relational modeling?
  • How will throttling, retries, and backup or restore events be handled operationally?

These questions are usually more useful than asking whether DynamoDB is "faster" than a relational database. The real issue is model fit.


12.10 Common Mistakes

  • modeling DynamoDB as if it were a relational database with arbitrary query flexibility
  • choosing a partition key without analyzing traffic distribution
  • creating hot partitions through highly concentrated access patterns
  • adding secondary indexes reactively without understanding the write and complexity trade-offs
  • ignoring consistency expectations in application code
  • treating throughput and scaling as billing-only topics instead of workload-shape topics
  • assuming fully managed infrastructure eliminates the need for alarms, backups, and IAM review
  • using DynamoDB where a relational model is clearly better suited to the business problem

12.11 Hands-On Tasks

  1. Pick one application workflow, such as orders by customer or sessions by user, and define the main DynamoDB access patterns.
  2. Propose a partition key and sort key design for that workflow.
  3. Identify one access pattern that may need a secondary index and explain why.
  4. Describe a hot-key risk for your design and how you would recognize it.
  5. Explain why a relational design process and a DynamoDB design process usually start from different questions.

12.12 Recap

DynamoDB is a fully managed NoSQL database built for high-scale, low-latency workloads, but it demands an access-pattern-first design mindset. Partition keys, sort keys, secondary indexes, and throughput choices all shape both performance and cost. Strong DynamoDB design begins by understanding how the application reads and writes data, not by copying relational habits into a different service.

Next: 13: ElastiCache

13: ElastiCache

Caching helps applications respond faster and reduces pressure on slower backend systems such as databases. Amazon ElastiCache provides in-memory data stores that applications can use to keep frequently accessed data close and fast.

This chapter explains why caching is powerful but also easy to misuse. You will learn how ElastiCache fits into application architecture, what kinds of data are good candidates for caching, and why expiration, consistency, and failure handling matter in production.


13.1 Why Caching Matters

As applications grow, the database is often asked to do too much.

Repeated reads for the same data can create:

  • unnecessary latency
  • avoidable database load
  • higher cost in the primary data tier
  • reduced headroom for truly important queries

Caching addresses this by keeping frequently needed data in a faster, temporary layer closer to the application.

Amazon ElastiCache is AWS's managed in-memory caching service for this pattern.

Caching matters because it can improve user experience and scalability dramatically, but it also introduces a second data layer with its own correctness and operational questions. That means architects need to understand not only why cache improves speed, but also when cache can make behavior more complex.


13.2 What a Cache Is and What It Is Not

A cache is usually a temporary store of data that can be recomputed or reloaded from a system of record.

That system of record is often a relational database, DynamoDB table, or another persistent backend.

This distinction is critical:

  • the cache speeds access
  • the system of record preserves truth

If the application cannot tolerate losing the cached data, then the workload may be using cache as if it were the primary database, which is usually a design smell.

Caching works best when the application can rebuild or repopulate the cached data safely. That is why cache strategy is tightly linked to application behavior and data freshness expectations.


13.3 ElastiCache and Common Use Cases

ElastiCache is used for in-memory data patterns such as:

  • caching frequently read query results
  • storing session data
  • maintaining short-lived counters or rate-limit state
  • improving response time for expensive computations or repeated lookups

These use cases share a common theme: the application benefits from very fast access to recently or frequently used data.

ElastiCache is helpful when the data is accessed far more often than it changes, or when the original computation or database read is expensive enough that repeated retrieval is wasteful.


13.4 Read Caching and Cache-Aside Thinking

One of the most common patterns is cache-aside.

In this model:

  1. the application checks the cache first
  2. if the item is present, it returns quickly
  3. if the item is missing, the application reads from the system of record
  4. the application then places the result in the cache for later reads

This works well because it keeps the database as the source of truth while still reducing repeated load.

But it also means you must think about:

  • how long cached data stays valid
  • what happens on cache miss storms
  • whether a deployment or expiration event can suddenly drive heavy traffic back to the database

Good cache design includes database protection thinking, not just fast-path thinking.


13.5 Write Patterns, Invalidation, and Freshness Trade-Offs

Caching becomes harder when data changes.

If the application updates the system of record, it also has to decide what to do with the cached value.

Common strategies include:

  • invalidate the cache entry after a write
  • update the cache immediately with the new value
  • rely on short time-to-live settings for acceptable staleness windows

There is no universal best option. The right choice depends on:

  • how stale data can be before it harms the business
  • how frequently the underlying data changes
  • how expensive it is to reload the value

Architects should always ask what user-visible error is worse: slightly stale data or much slower responses under load. Many cache decisions are trade-offs between those two failure modes.


13.6 Eviction, Time to Live, and Memory Pressure

Cache capacity is finite.

That means data does not stay in memory forever. ElastiCache design needs explicit thinking about:

  • time to live, or TTL, values
  • which data deserves to stay cached longer
  • what happens when memory pressure causes eviction
  • whether the application can tolerate frequent misses during churn

If the TTL is too short, the cache may provide little benefit. If it is too long, stale data may linger or memory may be spent on low-value items.

This is one of the main reasons cache design is application-specific. The value of a cached object depends on frequency, freshness, and reload cost.


13.7 High Availability, Failure Behavior, and Operational Risk

Caches fail too.

When they do, the application should degrade safely.

Important questions include:

  • Can the application continue if the cache is unavailable?
  • Will the database survive a sudden return of read traffic?
  • Does the application treat cache timeouts as a hard failure or a soft fallback condition?
  • What monitoring detects elevated miss rates, latency, or connection failures?

Architecturally, the safest mindset is that cache improves performance but should not become a single point of failure for correctness.

If a cache outage takes down the whole application, the system has likely coupled the cache too tightly to the critical path.


13.8 Security and Access Boundaries

Caches often hold sensitive or semisensitive data, even if only temporarily.

That means you still need to review:

  • which application components can connect
  • network placement and security groups
  • whether credentials or secrets are managed safely
  • whether the cached data itself should be minimized or redacted

The fact that cache contents are short-lived does not make them harmless. A cached session token or customer profile fragment can still be sensitive.

Strong caching practice includes deciding what should never be cached at all.


13.9 Architect Decision Patterns for Caching

When reviewing a design that introduces ElastiCache, ask:

  • What specific read or computation bottleneck is the cache solving?
  • What is the system of record if the cache is empty?
  • How fresh must the data be?
  • How are writes and invalidations handled?
  • What happens if the cache fails or is cold after deployment?
  • Does the cost and operational complexity of cache justify the benefit?

These questions prevent teams from adding cache because it sounds advanced rather than because it solves a clear problem.

The best caching layers are narrowly justified and carefully bounded.


13.10 Common Mistakes

  • adding cache before identifying the real bottleneck
  • treating cache as the system of record instead of a performance layer
  • ignoring invalidation strategy and then serving stale data unpredictably
  • choosing TTL values without understanding update frequency or read patterns
  • failing to protect the database from miss storms during cache cold starts or outages
  • storing sensitive data in cache without reviewing whether it should be cached at all
  • coupling the application so tightly to the cache that cache failure becomes application failure
  • assuming caching always reduces cost without considering operational complexity and extra infrastructure

13.11 Hands-On Tasks

  1. Identify one read-heavy path in an application and explain why it is a good or bad candidate for caching.
  2. Describe a cache-aside flow for a product-details API or a user-profile API.
  3. Choose whether the cached value should be invalidated on write or left to expire, and explain the trade-off.
  4. Define what should happen if the cache is unavailable during peak traffic.
  5. List two data types that should probably not be cached without careful review.

13.12 Recap

ElastiCache helps applications reduce latency and offload databases by storing frequently used data in memory, but it adds a second data-access layer that must be designed carefully. Strong caching architecture defines the system of record clearly, chooses appropriate TTL and invalidation behavior, and ensures the application can degrade safely when the cache is cold or unavailable. Cache is a performance tool, not a substitute for sound data design.

Next: 14: Lambda

14: Lambda

AWS Lambda runs code in response to events without requiring you to manage servers directly. It is a core serverless service and is often used for APIs, file processing, automation, and event-driven workflows.

This chapter explains where Lambda works well and where its limits matter. You will learn how functions are invoked, how scaling and concurrency behave, and why packaging, permissions, execution time, and networking decisions affect reliability and cost.


14.1 Why Lambda Matters

AWS Lambda lets you run code without managing servers directly.

That changes more than provisioning. It changes how you think about workload boundaries, scaling, operations, and failure handling.

Lambda is useful when work is naturally triggered by an event, request, schedule, or message. Common examples include:

  • processing API requests
  • reacting to object uploads
  • transforming queue messages
  • running scheduled maintenance tasks
  • orchestrating small integration steps between managed services

The service is attractive because AWS handles server provisioning, patching of the managed runtime environment, and elastic scale for many bursty workloads.

That does not mean there is no infrastructure thinking left. A solutions architect still has to decide:

  • whether the workload is truly event-driven
  • how much execution time and memory it needs
  • how retries and duplicate events should be handled
  • what happens when downstream systems are slow or unavailable
  • whether cold starts, concurrency limits, or VPC networking behavior will matter

Lambda is not a universal replacement for containers or virtual machines. It is a strong fit when the workload benefits from short-lived execution, fine-grained scaling, and deep integration with other AWS services.


14.2 The Lambda Execution Model

A Lambda function is code packaged with configuration such as runtime, memory, timeout, environment variables, and an execution role.

When an event arrives, Lambda creates or reuses an execution environment to run the function.

There are two important phases to understand:

  • initialization, when the runtime starts and top-level code is loaded
  • invocation, when the handler processes one event

If AWS can reuse an existing execution environment, later invocations can be faster because initialization does not need to happen again. This is why developers often talk about warm starts and cold starts.

Important consequences of the execution model:

  • execution environments are ephemeral and should not be treated as durable state
  • temporary local storage is limited and should be used carefully
  • top-level initialization cost affects cold-start latency
  • any in-memory cache is best-effort only and may disappear at any time

This model favors stateless design. Durable state should normally live in services such as DynamoDB, S3, RDS, ElastiCache, or another managed data system depending on the workload.


14.3 Invocation Models and Event Sources

Lambda supports several invocation patterns, and the behavior of retries, latency, and failure handling changes depending on which pattern you use.

Synchronous invocation

The caller waits for the response.

Common examples:

  • API Gateway invoking Lambda for an API request
  • an application directly calling the Lambda Invoke API

In synchronous flows, timeout and end-user latency matter immediately. If the function is slow, the user experiences that delay directly.

Asynchronous invocation

The caller hands the event to Lambda and does not wait for the function result.

Common examples:

  • S3 event notifications
  • EventBridge rules
  • SNS topics

Lambda queues the event internally and retries on failure according to the integration behavior. That improves decoupling, but it also means duplicate delivery and delayed failure handling must be part of the design.

Poll-based invocation

Lambda can poll event sources such as SQS queues, Kinesis streams, or DynamoDB Streams.

In these cases, Lambda manages reading batches from the source and invoking the function with those records.

Architecturally, the invocation source decides several things for you:

  • whether the caller expects a response now
  • who owns retry behavior
  • whether events may be batched
  • what ordering guarantees, if any, exist
  • how backpressure appears when downstream processing slows down

You cannot design Lambda correctly without first understanding the event source contract.


14.4 IAM, Resource Access, and Execution Roles

Every Lambda function runs with an execution role.

That role defines what AWS APIs the function can call. For example, the function may need permission to:

  • write logs to CloudWatch Logs
  • read from Parameter Store or Secrets Manager
  • publish to SNS
  • read or write S3 objects
  • query DynamoDB

This ties directly to the IAM chapter: Lambda functions should use least-privilege roles instead of embedded credentials.

There are two access directions to keep clear:

  • what is allowed to invoke the function
  • what the function is allowed to access after it starts running

Those are separate concerns.

For example:

  • API Gateway may have permission to invoke a function
  • the function itself may have permission to write to DynamoDB

Over-permissive Lambda roles are a common production risk. A small function with broad * permissions can become a large blast-radius problem if the code is compromised or misused.

Good practice includes:

  • one role per workload boundary, not one giant shared role for everything
  • explicit permissions for only the required resources and actions
  • secrets retrieved from managed secret stores rather than hard-coded environment values
  • log access reviewed so sensitive data is not exposed in plain text

14.5 Concurrency, Scaling, and Throttling

Lambda scales by increasing concurrent executions when more events arrive.

This scaling model is powerful because you do not manually add servers, but it introduces control points that matter in production.

Key terms:

  • concurrency: the number of function invocations running at the same time
  • reserved concurrency: a hard allocation and cap for one function
  • provisioned concurrency: pre-initialized environments to reduce startup latency

Why this matters:

  • a traffic spike can create far more downstream database connections than expected
  • one noisy function can consume too much account concurrency if not controlled
  • latency-sensitive APIs may need provisioned concurrency to reduce cold-start impact

Throttling happens when a function cannot scale further because of concurrency limits. From an architecture standpoint, throttling is not only a Lambda problem. It is often a sign that the surrounding system has no backpressure strategy.

Design questions a solutions architect should ask:

  • Should this workload absorb spikes through SQS instead of scaling directly from user traffic?
  • Can the database handle the concurrency Lambda can generate?
  • Is user-facing latency strict enough to justify provisioned concurrency?
  • Should reserved concurrency protect critical functions from being starved by less important ones?

Serverless scale is real, but it must be matched with downstream capacity planning.


14.6 Packaging, Runtimes, and Dependency Strategy

Lambda supports multiple runtimes and packaging models, including zip-based deployment packages and container images.

The choice should reflect the workload, team workflow, and dependency footprint.

Zip package model

This is the common starting point for small and medium functions.

It works well when:

  • dependencies are modest
  • build and deployment are simple
  • startup speed matters

Container image model

This is useful when:

  • the dependency graph is large
  • the runtime needs OS-level customization
  • the team already has a container-based build pipeline

Container images do not turn Lambda into a container orchestrator. The function still runs inside Lambda's execution model, limits, and event lifecycle.

Packaging decisions also affect cold starts. Large dependency bundles and heavy initialization logic often make startup slower.

A practical rule is to keep functions focused:

  • smaller deployment units are easier to reason about
  • smaller dependency surfaces reduce security and startup overhead
  • narrower functions usually map better to event-driven responsibilities

If one Lambda function starts becoming a large application container with many unrelated code paths, the architecture may be pushing against the service model.


14.7 State, Storage, and VPC Networking

Lambda functions should generally be treated as stateless.

That means:

  • no assumption that one invocation will run on the same environment as the next
  • no assumption that local files will survive beyond the current environment lifetime
  • no assumption that in-memory objects are durable

For durable storage, use an external service that matches the access pattern.

Examples:

  • S3 for objects and generated files
  • DynamoDB for key-value and event-oriented application state
  • RDS or Aurora for relational workloads
  • ElastiCache for low-latency shared cache state

Lambda can also be attached to a VPC when it needs private network access, such as reaching:

  • RDS databases in private subnets
  • internal services behind private load balancers
  • private endpoints for AWS services

This decision has consequences:

  • VPC attachment adds network complexity
  • subnet and security-group design now matter for function connectivity
  • poor outbound design can force all traffic through NAT and add cost

The question should not be, "Can this function run in a VPC?" The better question is, "Does this function actually need private network access, and if so, have we designed that path deliberately?"


14.8 Errors, Retries, Idempotency, and Observability

Many Lambda failures are not code syntax failures. They are retry, timeout, duplication, or observability failures.

You need to think in failure modes.

Important behaviors to design for:

  • asynchronous sources may retry failed events
  • queue-based sources may re-deliver messages
  • partial failures in a batch may require careful handling
  • downstream APIs may throttle or fail transiently

This is why idempotency matters.

An idempotent function can safely process the same event more than once without creating duplicate business outcomes. That often requires:

  • stable event identifiers
  • conditional writes
  • deduplication records
  • clear separation between read, validate, and commit steps

Observability is equally important. At minimum, production Lambda workloads should have:

  • structured logs in CloudWatch Logs
  • metrics and alarms for errors, duration, throttles, and concurrency
  • request tracing where supported, often through X-Ray or integrated observability tooling
  • clear dead-letter or failure destinations where the integration supports them

If a function retries quietly and fails without alarm coverage, the system is not really serverless. It is just invisible failure.


14.9 Lambda Design Patterns and Decision Criteria

Lambda works best when the unit of work is small, event-driven, and loosely coupled.

Strong fit patterns include:

  • API backends with moderate request duration
  • file and image processing triggered by S3 events
  • asynchronous queue consumers
  • scheduled control-plane tasks
  • lightweight data transformation or enrichment steps

Weaker fit patterns include:

  • very long-running compute jobs
  • workloads needing large local state or persistent connections as a core design assumption
  • highly stateful systems with tight low-latency coordination between processes
  • applications better served by always-on containers or hosts

An architect checkpoint for Lambda is to evaluate five things together:

  • event source contract
  • execution duration profile
  • state and data access model
  • concurrency effect on downstream systems
  • operational visibility and replay strategy

If those five factors line up well, Lambda is usually a strong choice. If they do not, using Lambda anyway can hide complexity rather than remove it.


14.10 Common Mistakes

  • assuming Lambda removes the need for architecture and operations discipline
  • giving functions broad IAM permissions instead of least-privilege execution roles
  • ignoring duplicate event delivery and building non-idempotent handlers
  • attaching functions to a VPC without understanding subnet, route, and egress implications
  • allowing unbounded concurrency to overwhelm databases or third-party APIs
  • packaging large, slow-starting functions when smaller focused functions would fit better
  • storing secrets directly in code or plain environment variables without managed secret controls
  • relying on local temporary state as if it were durable application storage
  • skipping alarms for errors, throttles, and age of queued work
  • choosing Lambda for long-running or heavily stateful workloads that fit containers better

14.11 Hands-On Tasks

  1. Create a simple Lambda function that logs an input event and returns a small JSON response.
  2. Configure the function with a minimal execution role that only allows CloudWatch Logs writes.
  3. Invoke the function synchronously and inspect the returned payload and logs.
  4. Trigger the function asynchronously from an EventBridge schedule and compare the behavior.
  5. Add an environment variable and explain which values belong there and which should move to Secrets Manager or Parameter Store.
  6. Set a timeout and memory value, then explain how each setting affects runtime behavior and cost.
  7. Describe one workload that fits Lambda well and one that should run on containers or EC2 instead.
  8. Sketch an idempotency strategy for a Lambda function that processes order-created events.

14.12 Recap

  • Lambda is event-driven compute that removes server management but not architecture responsibility.
  • Invocation model matters because synchronous, asynchronous, and poll-based sources behave differently under failure.
  • Execution roles, least privilege, and managed secret handling are core security requirements.
  • Concurrency and throttling must be designed together with downstream system capacity.
  • Packaging size, initialization cost, and VPC networking choices directly affect latency, cost, and operability.
  • Reliable Lambda systems depend on idempotency, observability, and explicit failure-handling strategy.

Next: 15: API Gateway

15: API Gateway

An Application Programming Interface (API) is often the front door to an application. Amazon API Gateway helps you publish, secure, and manage APIs so clients can call backend services in a controlled and observable way.

This chapter shows how API Gateway is used in front of AWS Lambda, containers, and other services. You will learn why endpoint type, authentication, throttling, stages, and integrations matter when building APIs that are safe to expose to real users.


15.1 Why API Gateway Matters

Most production systems need a controlled way for clients to call backend services.

That control layer is not only about routing HTTP requests. It is where you often enforce:

  • authentication and authorization
  • request validation
  • throttling and quotas
  • versioning and deployment stages
  • observability for request traffic

Amazon API Gateway is AWS's managed API front door service for HTTP, REST, and WebSocket workloads.

It is especially common with Lambda-based systems, but it can also front HTTP services and some AWS service integrations directly.

For a solutions architect, API Gateway matters because it provides a durable boundary between clients and backend implementation details. That boundary helps with security, gradual rollout, operational visibility, and scaling.

Without that boundary, teams often expose backend components too directly and lose control over request policy, client behavior, and failure handling.


15.2 What API Gateway Actually Provides

API Gateway receives client requests, matches them to routes or methods, and sends them to a configured integration target.

Depending on the API type and design, it can also handle:

  • TLS termination
  • custom domains
  • request and response transformation
  • authentication hooks
  • usage plans and rate limiting
  • metrics and access logging

This is important because API Gateway is not just a router. It is a policy and mediation layer.

That means architects should think about three boundaries separately:

  • client boundary: what the caller sees and is allowed to send
  • API boundary: what policies and validation are enforced at the front door
  • backend boundary: what service actually fulfills the request

When those boundaries are designed clearly, APIs are easier to evolve. When they are not, backend behavior leaks outward and clients become tightly coupled to internal implementation choices.


15.3 API Types and When to Choose Them

API Gateway supports multiple API models, and the choice affects cost, feature depth, and operational complexity.

HTTP APIs

HTTP APIs are typically the simpler and lower-cost option.

They are often a strong fit for:

  • straightforward Lambda-backed APIs
  • modern JWT-based authorization flows
  • internal or public APIs that do not need the full older REST API feature set

REST APIs

REST APIs provide a broader feature set and more mature controls in some areas.

They are often chosen when you need:

  • advanced request transformation behavior
  • API keys and usage-plan-oriented controls
  • legacy compatibility with an existing design pattern

WebSocket APIs

These are used for bidirectional, long-lived client communication patterns such as:

  • real-time dashboards
  • collaborative applications
  • push-style application messaging

The architect question is not, "Which API type is best in general?" It is, "Which API type provides the needed control plane without unnecessary complexity or cost?"

For many new request-response APIs, HTTP APIs are the sensible first evaluation point.


15.4 Routes, Methods, Stages, and Custom Domains

An API needs structure.

That structure usually includes:

  • routes or resources
  • HTTP methods such as GET, POST, PUT, and DELETE
  • deployment stages such as dev, test, and prod
  • optional custom domains for stable client-facing names

Stages are operationally important because they let you separate environments and rollout behavior.

Good API design usually keeps these concerns explicit:

  • URL structure should reflect business resources clearly
  • stages should not become a substitute for proper environment isolation where separate accounts are more appropriate
  • custom domains should hide implementation-specific hostnames from consumers

Versioning also matters. If you expect breaking changes, plan the version boundary deliberately. That may appear in:

  • the path
  • the domain structure
  • the deployment process

The point is not to over-engineer versioning from day one. The point is to avoid pretending APIs never change.


15.5 Authentication, Authorization, and Exposure Control

API Gateway can enforce several access patterns depending on the use case.

Common options include:

  • IAM-based authorization for AWS-authenticated callers
  • Cognito or JWT-based authorization for user-facing applications
  • Lambda authorizers for custom token validation logic

The correct choice depends on who the caller is.

Examples:

  • an internal AWS service or script may use IAM authorization
  • a mobile or web application may use JWT tokens issued by an identity provider
  • a specialized enterprise integration may require custom authorization logic

Security should not stop at identity. Exposure scope matters too.

Architectural controls can include:

  • private APIs for internal access patterns
  • resource policies that restrict who can call the API
  • AWS WAF in front of public endpoints for application-layer filtering
  • rate limits to reduce abuse and accidental overload

Public API does not have to mean fully open API. A well-designed public endpoint still enforces identity, policy, and request discipline.


15.6 Integrations, Transformations, and Backend Decoupling

API Gateway can integrate with several backend styles.

Common patterns include:

  • Lambda proxy integrations
  • HTTP integrations for services running behind load balancers or public endpoints
  • direct AWS service integrations in some designs

The integration choice affects how much mediation happens at the API layer.

Proxy-style integrations are simple and common because the backend receives the request with minimal front-door transformation. That simplicity is good for speed of development, but it also pushes more responsibility into the backend.

More explicit transformation patterns can decouple the client-facing contract from the backend shape, but they add complexity.

Important questions:

  • Should the backend own request validation, or should some validation happen earlier?
  • Do clients need a stable contract even if backend payloads evolve?
  • Are backend errors being mapped into useful client responses, or just passed through blindly?

An API layer should reduce coupling, not become a thin tunnel that exposes backend internals directly.


15.7 Throttling, Quotas, and Failure Handling

Every API needs traffic control.

Without it, one badly behaved client or one sudden spike can damage the whole system.

API Gateway provides controls such as:

  • throttling limits
  • quotas through usage plans in supported models
  • request size and payload boundaries
  • timeout constraints that shape backend expectations

These controls are not only about abuse prevention. They are part of resilience design.

If the backend is Lambda, traffic spikes can create concurrency surges. If the backend is a container service or database-backed application, request amplification can exhaust CPU, memory, or connection pools.

A good front-door design considers:

  • what happens when the backend is slow
  • which errors should be retried by the client
  • how to communicate rate limits clearly
  • whether some traffic should be moved to asynchronous patterns instead of synchronous APIs

Not every operation should be a live request-response call. Some workloads become more reliable when the API accepts a request and places durable work onto a queue.


15.8 Observability, Caching, Cost, and Performance

API Gateway is part of the runtime path, so it needs operational visibility.

Important signals include:

  • request count
  • latency
  • integration latency
  • error rates by status code family
  • throttled requests

Access logs and structured correlation identifiers help trace a request across the API layer and backend services.

Caching can reduce backend load for read-heavy patterns, but it should be used deliberately. The architect must consider:

  • whether responses are safe to cache
  • how stale data is tolerated
  • how cache invalidation will happen

Cost also depends on traffic shape. API Gateway is operationally convenient, but per-request pricing matters at high scale.

That means the right design sometimes includes:

  • moving static content to CloudFront and S3
  • using asynchronous processing where synchronous APIs would be wasteful
  • choosing HTTP APIs when the simpler feature set is enough

Performance should be evaluated across the full request path, not only the API service in isolation.


15.9 API Gateway Design Patterns and Decision Criteria

API Gateway is strongest when you need a managed entry layer with security, governance, and integration control.

Good fit patterns include:

  • Lambda-backed APIs for web and mobile clients
  • internal service APIs with controlled authentication and rate limits
  • asynchronous request intake where the API fronts queue-based workflows
  • multi-environment APIs with staged rollout and clear client contracts

Less ideal patterns include:

  • extremely latency-sensitive internal traffic where another integration model is simpler
  • APIs whose needs are so minimal that a full gateway layer adds more complexity than value

An architect checkpoint for API Gateway should review:

  • who the callers are
  • how identity will be enforced
  • what backend contract should remain hidden
  • what traffic shaping is required
  • what the fallback strategy is when the backend is degraded

If the API front door does not make the system safer, clearer, or easier to operate, it may not be designed at the right abstraction level yet.


15.10 Common Mistakes

  • exposing backend services directly without a clear API boundary
  • choosing an API type based on habit instead of required features and cost profile
  • pushing every workload into synchronous APIs when queue-based or event-driven designs would be safer
  • skipping throttling and letting clients overload downstream systems
  • using overly permissive authorization or treating public reachability as acceptable by default
  • leaking backend error details directly to clients
  • using stages as the only form of environment separation when account-level isolation is needed
  • adding transformation complexity without a clear decoupling benefit
  • ignoring access logs, correlation IDs, and latency breakdowns
  • assuming API Gateway alone solves application security without backend validation and safe coding practices

15.11 Hands-On Tasks

  1. Create a small HTTP API that routes one GET request to a Lambda function.
  2. Add a second route and explain how route structure should map to business resources rather than internal implementation names.
  3. Configure logging and inspect latency and status metrics for a few test calls.
  4. Add authorization and explain why the chosen method fits the caller type.
  5. Set a throttling limit and describe what problem it protects against.
  6. Return a controlled error from the backend and verify the client-facing response shape.
  7. Explain when this API should remain synchronous and when it should instead hand work to SQS.
  8. Sketch a versioning strategy for a future breaking change.

15.12 Recap

  • API Gateway is a managed front door for APIs, not just a request router.
  • The right API type depends on needed features, cost sensitivity, and client pattern.
  • Routes, stages, custom domains, and version boundaries should be deliberate operational choices.
  • Authorization, resource policies, throttling, and backend isolation are core security and reliability controls.
  • Integration style affects coupling, error handling, and where validation logic belongs.
  • Strong API designs treat observability, traffic shaping, and backend protection as first-class concerns.

Next: 16: SQS, SNS, and EventBridge

16: SQS, SNS, and EventBridge

Modern systems often work better when parts of the application do not talk to each other directly. Amazon Simple Queue Service (Amazon SQS), Amazon Simple Notification Service (Amazon SNS), and Amazon EventBridge are AWS services for messaging and event-driven communication.

This chapter explains the different delivery models they provide and why those differences matter. You will learn when to use a queue, when to use publish and subscribe, and when an event bus is the better choice for decoupling systems, absorbing traffic spikes, and routing events cleanly.


16.1 Why Messaging and Eventing Matter

Tightly coupled systems fail badly under load and change slowly over time.

If one service can only work when another service responds immediately, every latency spike and downstream failure becomes an end-user problem.

Messaging and eventing help break that coupling.

They let you:

  • absorb traffic spikes
  • separate producers from consumers
  • retry work safely
  • fan out information to multiple subscribers
  • evolve systems without direct point-to-point integration everywhere

AWS provides multiple services because not all communication patterns are the same.

Sometimes you need a queue for durable work. Sometimes you need publish-subscribe fan-out. Sometimes you need event routing across many producers and consumers without direct awareness of each other.

Choosing correctly matters because delivery semantics define how reliable, scalable, and understandable the system will be.


16.2 Amazon SQS: Durable Queue-Based Decoupling

Amazon Simple Queue Service, or Amazon SQS, is a managed message queue.

A producer sends a message to the queue. A consumer reads the message and processes it later.

This separation is powerful because it removes the requirement that producer and consumer be available at the same time.

SQS is commonly used for:

  • background job processing
  • order and payment workflow steps
  • buffering traffic spikes before workers consume them
  • protecting downstream systems from sudden load bursts

Important SQS behavior:

  • messages are stored durably for a retention period
  • consumers poll the queue
  • after a consumer receives a message, the message becomes temporarily invisible through the visibility timeout
  • if processing fails or is not completed correctly, the message can be delivered again

This means SQS supports reliability, but not exactly-once business outcomes by itself. Consumers still need idempotent handling.


16.3 Standard and FIFO Queues

SQS offers two main queue types.

Standard queues

These are the default choice for most workloads.

They provide:

  • high throughput
  • at-least-once delivery
  • best-effort ordering

This is usually enough for asynchronous work where processing order is not the primary requirement.

FIFO queues

FIFO means first in, first out.

These queues are used when ordering and deduplication behavior matter more strictly.

They provide:

  • ordered delivery within message groups
  • deduplication controls

The trade-off is that FIFO adds design constraints and typically lower throughput characteristics than unconstrained standard queue usage.

The architect decision is simple in principle: do not choose FIFO unless ordering is a real business requirement. Using FIFO by default creates unnecessary constraints.


16.4 Amazon SNS: Publish-Subscribe Fan-Out

Amazon Simple Notification Service, or Amazon SNS, is a publish-subscribe service.

A publisher sends one message to a topic, and multiple subscribers can receive copies.

SNS is useful when one event should trigger several downstream reactions.

Examples:

  • an order-created event notifies analytics, fulfillment, and customer communication systems
  • operational alerts are sent to email, chat, or automated handlers
  • one application event fans out to multiple SQS queues for independent processing

SNS is not a queue replacement. It is a fan-out mechanism.

That distinction matters because subscribers may be:

  • Lambda functions
  • SQS queues
  • HTTP endpoints
  • email or SMS targets in some notification scenarios

If you need independent durable processing, SNS often works best when it fans out into separate SQS queues rather than pushing complexity directly into every consumer endpoint.


16.5 Amazon EventBridge: Event Routing at System Scale

Amazon EventBridge is an event bus service designed for event routing between AWS services, SaaS integrations, and custom applications.

Instead of one producer knowing every consumer directly, producers emit events to a bus and rules decide which targets should receive them.

EventBridge is especially useful for:

  • application event buses in decoupled architectures
  • routing events based on content patterns
  • integrating AWS service events with downstream automation
  • scheduled rules and event-driven control-plane workflows

Its strength is routing and filtering.

That means EventBridge often fits when you want:

  • event contracts that multiple teams can subscribe to
  • rules based on event content rather than one fixed topic per use case
  • looser coupling between producers and consumers

EventBridge is event routing, not a queue substitute for heavy worker buffering. If the consumer needs durable backlog handling and work pulling, SQS is still often part of the design.


16.6 How to Choose Between SQS, SNS, and EventBridge

The right service depends on the communication pattern.

Choose SQS when:

  • one consumer group should process durable work items
  • you need backlog absorption and pull-based consumption
  • you want to protect a downstream system from spikes

Choose SNS when:

  • one message should fan out to multiple subscribers
  • publishers should not manage multiple point-to-point sends
  • topic-based pub-sub is enough

Choose EventBridge when:

  • you want event bus style routing based on event content or source
  • many producers and consumers should stay loosely coupled
  • AWS service events or scheduled rules are part of the design

In real systems, these services are often combined.

Example pattern:

  • an application emits an order event to EventBridge
  • rules route the event to several SQS queues
  • each queue feeds an independent worker or Lambda consumer

That combination gives routing flexibility plus durable workload buffering.


16.7 Retries, Dead-Letter Queues, and Idempotency

Messaging systems are only useful if failure behavior is designed clearly.

Important concepts include:

  • retries for transient failures
  • dead-letter queues for messages that repeatedly fail
  • visibility timeout tuning for SQS consumers
  • idempotent processing so duplicate delivery does not create duplicate outcomes

For SQS, visibility timeout must be longer than realistic processing time, or the same message may be delivered to another consumer before the first one finishes.

Dead-letter queues help isolate poison messages, but they are not a solution by themselves. You still need a plan for:

  • alerting when messages accumulate there
  • inspecting failure causes
  • replaying or correcting messages safely

SNS and EventBridge also have retry and target-failure behaviors that must be understood before production use.

The real design lesson is this: at-least-once delivery is common, so business operations must be safe to retry.


16.8 Security, Filtering, and Operational Visibility

Messaging systems carry business events, so access control matters.

You should review:

  • who can publish
  • who can consume
  • whether resource policies are needed for cross-account access
  • whether messages contain sensitive data that needs encryption controls

Filtering is equally important for reducing waste.

Examples:

  • SNS subscription filter policies can reduce unnecessary consumer traffic
  • EventBridge rules can route only the events that match a specific pattern

Operational visibility should include:

  • queue depth and age metrics
  • consumer error rates
  • delivery failure metrics where available
  • alarms for growing backlog or dead-letter activity

If messages are flowing but nobody is watching backlog age, the system can fail silently while appearing healthy.


16.9 Messaging Patterns and Architect Checkpoints

These services are most valuable when used as architectural building blocks rather than isolated features.

Common patterns include:

  • queue-based work distribution for asynchronous processing
  • topic fan-out for multi-subscriber notifications
  • event bus routing for domain events across bounded systems
  • API-to-queue handoff for workloads that should not stay synchronous

An architect checkpoint should review:

  • what delivery guarantee the business actually needs
  • whether ordering is a true requirement or only an assumption
  • how duplicate delivery will be handled
  • what backlog and replay behavior should look like during incidents
  • whether one consumer's failure should affect others

If those questions are unresolved, the integration pattern is not ready for production regardless of how easy the AWS setup looks.


16.10 Common Mistakes

  • using synchronous service-to-service calls where durable queues would better absorb failure and load
  • choosing FIFO queues without a true ordering requirement
  • assuming a queue guarantees exactly-once business processing
  • setting SQS visibility timeout too short for realistic processing time
  • sending one event directly to many consumers instead of using fan-out or event routing patterns
  • confusing EventBridge routing with queue-style work buffering
  • skipping dead-letter handling or never monitoring dead-letter queues
  • letting producers and consumers share unclear event contracts
  • placing sensitive data in events without reviewing encryption and access boundaries
  • ignoring queue depth, age, and retry metrics until a backlog becomes user-visible

16.11 Hands-On Tasks

  1. Create a standard SQS queue and send several test messages.
  2. Consume those messages with a Lambda function or small worker and observe visibility-timeout behavior.
  3. Create an SNS topic and subscribe an SQS queue to it.
  4. Publish one message to the topic and verify that the queue receives a copy.
  5. Create an EventBridge rule that matches a simple custom event pattern and targets a Lambda function.
  6. Compare the mental model of the SQS queue, SNS topic, and EventBridge bus in your own words.
  7. Configure a dead-letter queue and explain what operational process should follow if messages land there.
  8. Describe a realistic workload that should use API Gateway plus SQS instead of a long synchronous backend call.

16.12 Recap

  • SQS provides durable queue-based decoupling and backlog absorption.
  • SNS provides publish-subscribe fan-out to multiple subscribers.
  • EventBridge provides event bus routing and filtering across producers and consumers.
  • Delivery guarantees, retries, and ordering behavior differ and must be designed explicitly.
  • Dead-letter queues, visibility timeout tuning, and idempotent consumers are key reliability controls.
  • Strong messaging architectures choose services by communication pattern, not by brand similarity.

Next: 17: Step Functions

17: Step Functions

AWS Step Functions is a workflow orchestration service that coordinates multiple steps in a process. Instead of hiding control flow inside custom application code, you describe the workflow as a state machine and let AWS run it.

This chapter explains why orchestration becomes important as systems grow. You will learn how Step Functions is used to connect services, manage retries and failures, and make multi-step business processes easier to understand, operate, and recover in production.


17.1 Why Workflow Orchestration Matters

Many business processes are not one step. They are sequences.

Examples include:

  • validate an order, reserve inventory, charge a payment method, and send notifications
  • start a data pipeline, wait for a batch job, transform outputs, and publish results
  • run approval, provisioning, and cleanup steps across multiple services

If this logic is buried inside one large application function, the system becomes hard to reason about. Retry logic mixes with business logic. Timeouts become awkward. Partial failure handling becomes inconsistent.

AWS Step Functions addresses this by making workflow control flow explicit.

Instead of writing all orchestration inside code, you define a state machine that coordinates the steps.

That improves:

  • visibility into the workflow path
  • retry and error policy clarity
  • separation between orchestration and task implementation
  • maintainability for long-running or branching processes

17.2 The State Machine Model

Step Functions workflows are defined as state machines.

Each state represents a unit of work or a control-flow decision.

Common state types include:

  • Task
  • Choice
  • Pass
  • Wait
  • Parallel
  • Map
  • Succeed
  • Fail

This model matters because it forces architects to think explicitly about how a process advances.

Questions that become visible in a state machine include:

  • what must happen first
  • what can happen in parallel
  • what should happen when one branch fails
  • where human or external waiting points exist
  • how the workflow ends cleanly

That visibility is a major reason Step Functions often improves reliability even before it reduces code complexity.


17.3 Standard and Express Workflows

Step Functions offers different workflow types with different trade-offs.

Standard workflows

These are typically used when you need:

  • durable long-running orchestration
  • detailed execution history
  • stronger control for complex business processes

Express workflows

These are often used when you need:

  • high-volume event processing
  • shorter-lived workflows
  • lower cost for very high request rates in the right pattern

The choice should depend on workload behavior, not naming preference.

If the process is business-critical, may run longer, or needs detailed audit-style visibility, Standard is often the safer choice. If the workflow is short, high-throughput, and fits the service profile, Express may be appropriate.

The architect should evaluate:

  • execution duration
  • traffic volume
  • observability depth needed
  • error analysis requirements
  • cost profile at expected scale

17.4 Service Integrations and Task Boundaries

Step Functions can coordinate many kinds of tasks.

Common examples include:

  • invoking Lambda functions
  • calling AWS service APIs directly in supported integrations
  • waiting for external callbacks in supported patterns

This is useful because not every step needs a Lambda wrapper.

If the workflow only needs to call another AWS API, direct service integration can reduce glue code and simplify operations.

Task boundaries still matter. Each state should represent a meaningful business or operational step, not arbitrary fragmentation.

Good task boundaries tend to be:

  • easy to retry safely
  • easy to observe independently
  • small enough to stay understandable
  • large enough to represent a real unit of work

If the state machine becomes a maze of tiny technical steps, orchestration clarity is lost.


17.5 Retries, Catches, Timeouts, and Compensation

One of Step Functions' biggest strengths is explicit failure handling.

You can define:

  • retries for transient errors
  • catch paths for alternative failure handling
  • timeouts for tasks or workflow sections
  • fallback logic when part of a workflow cannot complete

This makes failure behavior visible instead of implicit.

That visibility is especially important in multi-step business workflows. If payment succeeds but inventory reservation fails, the system may need compensation logic such as refunding or reversing a previous step.

Step Functions does not solve business compensation automatically. It makes the orchestration of those compensating steps explicit and testable.

Architecturally, this is a major improvement over burying retry loops and partial rollback logic inside a single long application method.


17.6 Data Flow and Payload Management

Every workflow passes data between states.

If that data flow is poorly designed, workflows become slow, fragile, and hard to debug.

Important concerns include:

  • what subset of input each state actually needs
  • what output should be passed to the next state
  • whether payload size is growing unnecessarily across steps
  • whether sensitive fields are being propagated more widely than needed

Step Functions provides data-shaping controls so each state can receive and return only the relevant portions of the payload.

That matters because orchestration data is not only a technical detail. It affects:

  • performance
  • cost
  • readability of execution history
  • exposure of sensitive information

A good rule is to keep workflow payloads intentional and minimal, while storing large durable state externally when needed.


17.7 Long-Running Workflows and Human Steps

Not all workflows finish quickly.

Some processes involve:

  • waiting for a batch job
  • pausing until an external system finishes work
  • human approval steps
  • timeout windows that last minutes or longer

This is where explicit orchestration is valuable.

Instead of writing custom polling code or leaving long waits inside compute runtime, Step Functions can model the waiting behavior directly.

The design benefit is operational clarity. You can see:

  • what step is currently active
  • what the workflow is waiting on
  • what timeout or callback condition will resume it

This makes long-running control flow easier to reason about than a collection of timers, queue handlers, and hidden state transitions spread across several codebases.


17.8 Security, Observability, and Cost

Like other AWS services, Step Functions needs clear IAM boundaries.

You should review:

  • which principals can start executions
  • which execution role the workflow uses for integrated service calls
  • whether sensitive payload data is logged or exposed too broadly

Observability is one of Step Functions' biggest strengths. Execution history helps operators understand:

  • which step failed
  • how long each state took
  • which retry or catch path was used
  • whether the workflow is stuck at a waiting point

Cost depends on workflow type and execution pattern. That means architects should evaluate:

  • how many state transitions the design creates
  • whether the workflow is overly fragmented
  • whether the problem truly needs orchestration at this level

Good Step Functions designs use the service for explicit workflow value, not because state machines look neat on a diagram.


17.9 Step Functions Design Patterns and Decision Criteria

Step Functions is a strong fit when the system needs explicit multi-step orchestration.

Common fit patterns include:

  • order and fulfillment workflows
  • document and media processing pipelines
  • operational runbooks and remediation flows
  • approval or callback-based business processes
  • fan-out and aggregate patterns where several tasks must complete before progressing

It is a weaker fit when:

  • the process is only one small task with no real branching or coordination need
  • teams are using it to hide an unclear domain model rather than solve orchestration explicitly

An architect checkpoint should ask:

  • does the business process actually have multiple durable steps
  • do retries and error paths need to be visible
  • is the workflow long-running or externally dependent
  • are tasks idempotent and safe to retry
  • does explicit orchestration simplify operations compared with custom control code

If the answer is yes, Step Functions often gives a cleaner and more production-aware solution.


17.10 Common Mistakes

  • embedding complex orchestration logic inside a single Lambda or service instead of modeling the workflow explicitly
  • choosing Express or Standard without evaluating duration, scale, and history needs
  • wrapping every AWS API call in Lambda when direct service integrations would be cleaner
  • skipping retry and catch design and assuming task implementations will handle everything internally
  • passing oversized or overly sensitive payloads through every state
  • fragmenting workflows into tiny states that obscure rather than clarify the process
  • failing to design compensation behavior for partial success scenarios
  • ignoring who can start executions or what permissions the workflow execution role has
  • building non-idempotent tasks that break when retries occur
  • using Step Functions where a simple queue consumer or single request handler would be enough

17.11 Hands-On Tasks

  1. Create a simple state machine with two task steps and one success state.
  2. Add a Choice state that routes based on a field in the input payload.
  3. Add retry behavior for a simulated transient failure.
  4. Add a catch path that records or handles a failure case explicitly.
  5. Replace one Lambda wrapper step with a direct AWS service integration if the workflow allows it.
  6. Inspect execution history and identify where time is spent across the workflow.
  7. Reduce the payload passed between two states and explain why that improves clarity.
  8. Describe one business workflow in your system that should use Step Functions instead of custom orchestration code.

17.12 Recap

  • Step Functions provides explicit workflow orchestration through state machines.
  • Standard and Express workflows solve different problems and should be chosen by workload behavior.
  • Retries, catches, waits, branching, and parallel steps make multi-step processes easier to reason about.
  • Data flow shaping, IAM boundaries, and execution visibility are key parts of production design.
  • Step Functions is strongest when coordination logic is the real problem to solve.
  • Clear orchestration reduces hidden control-flow bugs and improves operational understanding of complex workflows.

Next: 18: ECR

18: ECR

Amazon Elastic Container Registry (Amazon ECR) stores container images for deployment on AWS. It gives teams a central place to push, version, scan, and manage the artifacts that container platforms pull at runtime.

This chapter explains why image management is part of a secure delivery pipeline, not just a storage task. You will learn how repositories, tags, digests, lifecycle policies, and scanning help teams ship containers in a more repeatable and production-safe way.


18.1 Why ECR Matters

Containerized systems need a reliable place to store images before deployment.

That image registry is not just a file store. It is part of the software supply path.

If image storage is unmanaged or inconsistent, teams run into problems such as:

  • unclear image versions in production
  • weak access control around deployment artifacts
  • stale or vulnerable images lingering indefinitely
  • unreliable promotion between environments

Amazon Elastic Container Registry, or Amazon ECR, is AWS's managed container image registry.

It gives AWS-native workflows a place to push, store, scan, and pull images for services such as ECS, EKS, and some Lambda container-image deployments.

For a solutions architect, ECR matters because deployment reliability starts before runtime. You need to know exactly what artifact is being shipped, who can publish it, and how that artifact is controlled across environments.


18.2 Repositories, Tags, and Digests

ECR organizes images into repositories.

Each repository holds image manifests and layers for one application or component family.

There are two ways people commonly identify images:

  • tags, such as v1.4.2 or prod
  • digests, which uniquely identify the exact image content

Tags are convenient, but they are mutable unless you enforce immutability policies. Digests are stronger for precise deployment because they refer to one exact artifact.

This distinction matters in production.

If an environment deploys latest, you may not actually know what code is running without additional investigation. If an environment deploys a digest, the artifact identity is explicit.

Architecturally, strong delivery pipelines usually treat:

  • tags as human-friendly labels
  • digests as the immutable truth for what is deployed

That mindset reduces ambiguity during rollback, incident response, and audit review.


18.3 Image Push and Pull Workflow

The typical ECR workflow looks like this:

  1. Build a container image.
  2. Authenticate to ECR.
  3. Push the image to a repository.
  4. Reference that image from ECS, EKS, or another runtime.

The technical steps are straightforward, but the operational questions matter more:

  • who is allowed to push images
  • which pipeline or role should publish them
  • how environments decide what artifact is approved
  • whether production pulls by tag or by digest

In strong delivery systems, developers do not push ad hoc production artifacts from laptops. Publishing usually happens through controlled build pipelines with consistent identity and logging.

That improves repeatability and reduces supply-chain risk.


18.4 Access Control and Repository Security

ECR repositories are protected through IAM and repository policies.

You should separate at least three kinds of access:

  • who can push images
  • who can pull images
  • who can administer repository settings and policies

This matters in multi-environment and multi-account setups.

For example:

  • a build pipeline in one account may push images
  • a runtime service in another account may only pull approved images
  • security or platform teams may control repository policy and replication configuration

Encryption at rest is managed by AWS, but security still depends on identity design and operational discipline.

Good practice includes:

  • least-privilege roles for publishers and deployers
  • separation of build and runtime permissions
  • avoiding manual long-lived credentials for registry access
  • controlled cross-account pull permissions where needed

The registry is part of your deployment trust boundary, not just a developer convenience tool.


18.5 Vulnerability Scanning and Image Hygiene

Container registries accumulate risk if images are built once and then forgotten.

ECR supports vulnerability scanning capabilities that help teams identify known issues in pushed images.

Scanning is useful, but it is only one layer of image hygiene. You also need:

  • small base images where practical
  • regular rebuilds to pick up patched dependencies
  • clear ownership of repositories
  • removal of unused or outdated images

An important nuance is that a scan result is not a full security decision by itself.

Architects and operators still need to ask:

  • is the vulnerable package reachable in the actual workload
  • has the base image been refreshed recently
  • is this image still deployable under release policy

The correct response is not panic or indifference. It is controlled artifact hygiene.


18.6 Lifecycle Policies, Immutability, and Promotion

Without cleanup rules, ECR repositories grow indefinitely.

Lifecycle policies help remove old images according to rules such as tag prefixes, age, or image count.

That saves storage cost and keeps repositories easier to manage.

Immutability is equally important. If a tag can be overwritten freely, the same tag can mean different code at different times.

Production-aware teams often use one or both of these patterns:

  • immutable versioned tags, such as semantic version tags or build IDs
  • deployment by digest even when tags remain available for human reference

Promotion strategy also matters. You can either:

  • rebuild separately per environment, which may create artifact drift
  • build once and promote the same tested artifact across environments, which usually improves consistency

The second model is often more trustworthy because test and production use the same artifact identity.


18.7 Integration with ECS, EKS, Lambda, and CI/CD

ECR is rarely the end of the story. It sits between build and runtime.

Common integrations include:

  • ECS services pulling images during task launch
  • EKS workloads referencing images in Pod specs
  • CI/CD pipelines pushing tested build artifacts to a repository
  • Lambda functions deployed from container images in some cases

This makes naming and versioning strategy important.

If the registry structure does not reflect application boundaries clearly, deployment configuration becomes confusing. Teams should be able to answer quickly:

  • which repository holds which workload
  • which pipeline publishes to it
  • which runtime consumes it
  • which image version is currently deployed

ECR works best when those artifact boundaries are aligned with deployment ownership.


18.8 Replication, Availability, and Cost Considerations

Artifact availability can become a deployment dependency.

If you operate in multiple regions or accounts, replication strategy may matter for:

  • deployment speed
  • regional isolation
  • central platform governance

Cost is usually not the hardest part of ECR, but it still exists through:

  • stored image layers
  • data transfer patterns
  • duplicated artifacts across regions or accounts

Architects should also think about operational availability:

  • what happens if the pipeline cannot push new images
  • whether the runtime depends on pulling images during scale-out events
  • whether image layers are being rebuilt too often due to poor Dockerfile structure

Registry design is not usually the hardest AWS problem, but weak registry discipline creates repeated delivery friction.


18.9 ECR Design Patterns and Decision Criteria

ECR is a strong fit when your container workloads already run on AWS and you want a managed, IAM-integrated registry.

Useful design patterns include:

  • one repository per deployable service or component family
  • build once, promote the same artifact across environments
  • deploy by digest for strong artifact identity
  • use lifecycle policies to control repository growth

An architect checkpoint should review:

  • how images are named and versioned
  • whether tag immutability is enforced where needed
  • how scanning results influence release decisions
  • whether cross-account and cross-region access is deliberate
  • whether deployment systems reference trusted artifacts precisely

If artifact identity is unclear, the delivery system is weaker than it appears.


18.10 Common Mistakes

  • deploying mutable tags such as latest without clear artifact traceability
  • allowing broad push access instead of controlled pipeline publishing
  • treating vulnerability scans as optional background noise
  • keeping old images forever and never applying lifecycle policies
  • rebuilding different artifacts per environment when one tested artifact should be promoted
  • failing to separate image-push and image-pull permissions
  • using unclear repository naming that hides ownership and workload boundaries
  • ignoring cross-account or cross-region pull design until deployment time
  • assuming the registry is not part of the software supply-chain security boundary
  • storing images successfully but lacking a reliable record of what digest is running in production

18.11 Hands-On Tasks

  1. Create an ECR repository for a sample application.
  2. Build a small container image and push it to that repository.
  3. Pull the image by tag and then identify its digest.
  4. Enable or review image scanning and inspect the reported results.
  5. Add a lifecycle policy that removes old unneeded images.
  6. Describe whether your deployment system should reference the image by tag or digest and why.
  7. Sketch a promotion flow from dev to staging to production using the same image artifact.
  8. Explain which roles should be allowed to push images and which should only pull them.

18.12 Recap

  • ECR is the managed container registry layer for AWS container delivery workflows.
  • Repositories, tags, and digests define how image artifacts are stored and identified.
  • Strong production workflows publish images through controlled pipelines and deploy trusted artifacts precisely.
  • Scanning, lifecycle policies, and tag immutability improve security and artifact hygiene.
  • ECR integrates with ECS, EKS, Lambda container images, and CI/CD pipelines.
  • Clear artifact identity and access boundaries are core delivery requirements, not optional cleanup details.

Next: 19: ECS and Fargate

19: ECS and Fargate

Amazon Elastic Container Service (Amazon ECS) is AWS's container orchestration service, and AWS Fargate is a serverless compute option for running those containers. Together, they let you deploy applications in containers without building your own full container platform.

This chapter explains how tasks, services, clusters, and networking fit together at a high level. You will learn why some teams choose ECS on Amazon Elastic Compute Cloud (Amazon EC2) for more control, while others choose Fargate to reduce infrastructure management.


19.1 Why ECS and Fargate Matter

Containers package applications and dependencies into a consistent runtime unit, but containers still need an execution platform.

On AWS, Amazon Elastic Container Service, or Amazon ECS, provides a managed control plane for running and operating containers.

AWS Fargate is a launch model that lets you run ECS tasks without managing the underlying worker servers yourself.

These services matter because many teams want:

  • more packaging consistency than raw virtual machines
  • more control than purely function-based serverless workloads
  • less operational burden than building a full Kubernetes platform immediately

For a solutions architect, ECS and Fargate provide a middle ground between EC2 and higher-abstraction serverless compute. They are often a strong choice when the workload needs long-running services, custom runtimes, or container-native deployment patterns without adopting Kubernetes complexity too early.


19.2 The ECS Service Model

ECS organizes container workloads through a few core concepts.

Cluster

A cluster is the logical grouping where tasks and services run.

Task definition

A task definition describes how one or more containers should run, including:

  • container images
  • CPU and memory settings
  • environment configuration
  • networking mode details
  • log configuration

Task

A task is a running instance of a task definition.

Service

A service keeps the desired number of task instances running and can integrate with load balancers and scaling policies.

This model matters because it separates workload description from runtime state. The task definition declares what should run, and the service tries to keep that desired state true over time.

That is a major operational step up from manually starting containers on hosts.


19.3 ECS on EC2 vs ECS on Fargate

ECS supports different launch models.

ECS on EC2

In this model, you manage the EC2 instances that provide container capacity.

That gives you more control over:

  • host sizing
  • special runtime dependencies
  • daemon-level customization
  • packing multiple workloads onto shared instances

But it also means you manage:

  • instance patching
  • capacity planning
  • host scaling
  • AMI and runtime maintenance

ECS on Fargate

In this model, AWS manages the underlying compute hosts.

You focus on task sizing and workload definition instead of server fleet management.

This is attractive when:

  • you want operational simplicity
  • workloads vary enough that per-task isolation is useful
  • the team does not want to manage container hosts directly

The trade-off is reduced low-level host control and a cost model that may differ from heavily optimized EC2 fleets.

The architect question is not, "Is Fargate modern?" It is, "Do we benefit more from simplified operations or from deeper host-level control and capacity optimization?"


19.4 Networking, Load Balancing, and Service Exposure

Containerized services still need clear network boundaries.

In AWS, ECS tasks commonly run inside VPC subnets and are exposed through load balancers when they serve traffic.

Important design decisions include:

  • whether tasks run in public or private subnets
  • how inbound traffic reaches them
  • whether they need internet egress through NAT or private endpoints
  • which security groups apply to the service

For production workloads, common patterns include:

  • public Application Load Balancer in public subnets
  • ECS tasks in private subnets
  • databases and sensitive backends in more restricted private tiers

The network design should make it obvious which components are publicly reachable and which are not. Containers do not change the underlying VPC fundamentals. They just add another deployment unit inside that network model.


19.5 Scaling, Deployments, and Health Management

ECS services can scale task count based on demand and can replace unhealthy tasks automatically.

This supports a more resilient operating model, but only if health criteria are meaningful.

Key concerns include:

  • container health checks
  • load balancer target health
  • task restart behavior
  • auto scaling based on CPU, memory, queue depth, or other metrics

Deployment strategy matters too.

Rolling deployments can gradually replace tasks with a new version, but architects still need to think about:

  • how much spare capacity is available during rollout
  • what happens if startup is slow
  • whether the application is backward compatible during mixed-version windows

If the application fails readiness checks or opens connections too slowly, deployment behavior will look unreliable even when ECS itself is behaving correctly.


19.6 Storage, Configuration, and Secrets

Containers should generally be treated as replaceable runtime units.

That means you should assume:

  • a task can stop and be recreated elsewhere
  • local container filesystem state is not the source of truth
  • durable data belongs in external services or persistent storage designed for that access pattern

Configuration should also be managed deliberately.

Good practice includes:

  • environment-specific configuration handled outside the container image
  • secrets stored in services such as Secrets Manager or Parameter Store
  • image artifacts kept environment-neutral where possible

The more environment assumptions you bake into the image, the less portable and trustworthy the deployment artifact becomes.


19.7 IAM, Isolation, and Security Boundaries

Container platforms can create false confidence if the security model is vague.

For ECS, you should separate:

  • the permissions used by the platform to pull images and start tasks
  • the permissions that the running application needs at runtime

Runtime workloads should use task roles or equivalent mechanisms instead of baked-in credentials.

Other important security concerns include:

  • least-privilege network access through security groups
  • restricted image-pull permissions from ECR
  • vulnerability management for container images
  • careful review of which services share clusters or environments

Isolation is not just a technical setting. It is also an account, network, and operational-boundary question.


19.8 Observability, Cost, and Operations

A container platform is only useful if operators can see what the workloads are doing.

You should plan for:

  • application logs
  • container and service metrics
  • deployment event visibility
  • alarms on task failures, unhealthy targets, and scaling anomalies

Cost differs significantly between ECS on EC2 and ECS on Fargate.

Fargate often reduces operational burden, but EC2 can be more cost-efficient for steady, dense workloads when the team can manage the fleet well.

Operationally, the real trade-off is usually:

  • lower platform management effort with Fargate
  • greater packing efficiency and customization potential with EC2

That trade-off should be evaluated with real workload shape, not marketing assumptions.


19.9 ECS and Fargate Design Patterns and Decision Criteria

ECS is a strong fit when you want managed container orchestration on AWS without taking on full Kubernetes complexity immediately.

Good fit patterns include:

  • stateless web services behind load balancers
  • asynchronous workers pulling from queues
  • APIs that need long-running container processes
  • services that benefit from container packaging but not Kubernetes-level extensibility

An architect checkpoint should review:

  • whether the workload should run on ECS or another compute model entirely
  • whether Fargate or EC2 gives the better operations-to-cost trade-off
  • how scaling signals map to business demand
  • where configuration, secrets, and durable state live
  • whether deployment safety and observability are adequate

If those answers are clear, ECS is often one of the most pragmatic AWS runtime choices.


19.10 Common Mistakes

  • moving to containers without deciding whether the workload really needs long-running services
  • choosing Fargate or EC2 based on brand preference instead of operational and cost trade-offs
  • placing tasks in public subnets when a private-subnet plus load-balancer design is safer
  • treating container filesystems as durable state
  • baking secrets or environment-specific configuration into images
  • using weak health checks that fail to represent application readiness
  • forgetting to separate platform permissions from application runtime permissions
  • scaling services without considering downstream connection and database limits
  • deploying new task revisions without a clear rollback and visibility strategy
  • assuming containers automatically improve reliability without good networking, logging, and deployment discipline

19.11 Hands-On Tasks

  1. Create a task definition for a small containerized web application.
  2. Run that workload once as a task and then as a service.
  3. Compare what changes operationally between ECS on EC2 and ECS on Fargate.
  4. Place the service behind an Application Load Balancer and verify health behavior.
  5. Configure logs so task output is visible centrally.
  6. Inject a secret through a managed mechanism instead of baking it into the image.
  7. Add a scaling policy and explain which metric should drive it.
  8. Describe one workload that should stay on ECS and one that should move to Lambda or EKS instead.

19.12 Recap

  • ECS is AWS's managed container orchestration service for running tasks and services.
  • Fargate removes host management, while ECS on EC2 offers deeper control and potentially better packing efficiency.
  • Networking, load balancing, health checks, and scaling behavior are central to production container design.
  • Durable state, secrets, and configuration should live outside replaceable container instances.
  • IAM boundaries, image hygiene, and observability shape container security and operability.
  • ECS is often the pragmatic middle path between raw servers and full Kubernetes adoption.

Next: 20: EKS Basics

20: EKS Basics

Amazon Elastic Kubernetes Service (Amazon EKS) is AWS's managed Kubernetes platform. It runs the Kubernetes control plane for you, but you still need to understand how Kubernetes works and what operating responsibilities remain.

This chapter explains where EKS fits and why teams choose it. You will learn the basics of how workloads run on Kubernetes, how networking and identity affect cluster design, and why EKS is powerful but more operationally demanding than simpler AWS compute options.


20.1 Why EKS Matters

Some teams need more than a managed container runtime. They need the Kubernetes ecosystem, API model, and workload portability that comes with it.

Amazon Elastic Kubernetes Service, or Amazon EKS, provides a managed Kubernetes control plane on AWS.

This matters when teams want:

  • Kubernetes-native tooling and patterns
  • workload portability across environments
  • ecosystem integrations built around the Kubernetes API
  • fine-grained orchestration behavior beyond simpler container platforms

But EKS is not "containers, but better" by default. It introduces more moving parts and a larger operational surface than ECS.

For a solutions architect, the important question is not whether Kubernetes is popular. It is whether the system and the organization truly benefit from Kubernetes-level flexibility enough to justify the extra complexity.


20.2 What EKS Manages and What You Still Manage

EKS manages the Kubernetes control plane for you.

That reduces the burden of running core control-plane components, but it does not remove cluster operations entirely.

You still need to think about:

  • worker node strategy or serverless pod execution models where applicable
  • cluster upgrades
  • networking and ingress setup
  • observability
  • identity mapping
  • workload security and multi-tenant boundaries

This is a key architectural nuance.

EKS is managed Kubernetes, not no-operations Kubernetes.

If a team adopts EKS assuming AWS will make every cluster concern disappear, they usually discover the real complexity later during upgrades, incident response, or platform standardization.


20.3 Core Kubernetes Objects You Need to Understand

To use EKS responsibly, you need a working mental model of the main Kubernetes primitives.

Important concepts include:

  • Pods as the smallest deployable compute units
  • Deployments for managing replicated stateless workloads
  • Services for stable network access inside the cluster
  • Ingress or load-balancing mechanisms for external access
  • ConfigMaps and Secrets for configuration and sensitive values
  • Namespaces for logical separation

These concepts are powerful, but they are also a source of confusion for teams new to Kubernetes.

The architect should care less about memorizing every object type and more about understanding how declarative desired state, reconciliation, and cluster networking fit together.

Without that mental model, debugging cluster behavior becomes guesswork.


20.4 Worker Nodes, Scheduling, and Pod Placement

Kubernetes schedules pods onto worker capacity.

In EKS, that capacity may be managed through node groups or other supported execution approaches depending on the chosen operating model.

This introduces several production concerns:

  • instance sizing and node efficiency
  • pod resource requests and limits
  • scheduling behavior when nodes fill up
  • isolation for different workload classes

If resource requests are unrealistic, scheduling becomes unreliable. If limits are missing entirely, noisy workloads can damage cluster stability.

The scheduler is powerful, but it depends on good workload declarations. Architects should expect platform standards around resource settings, placement rules, and environment separation.


20.5 Networking, Ingress, and Service Connectivity

Kubernetes networking adds another abstraction layer on top of the AWS VPC model.

That means EKS teams need to understand both:

  • AWS networking boundaries such as subnets, route tables, and security groups
  • Kubernetes service connectivity and ingress patterns

Important design questions include:

  • how external traffic reaches workloads
  • how internal services discover each other
  • whether ingress is centralized or per-application
  • how network isolation is enforced between workloads and namespaces

Because EKS sits inside AWS networking, bad VPC design still causes trouble. Kubernetes does not replace foundational network architecture. It adds more networking decisions on top of it.


20.6 Identity, Security, and Multi-Tenancy

Cluster security is one of the most important reasons not to adopt Kubernetes casually.

In EKS, you need to think about:

  • who can administer the cluster
  • how workloads access AWS services
  • what separation exists between teams or applications sharing a cluster
  • how secrets are stored and consumed

This usually involves a mix of AWS IAM, Kubernetes RBAC, and workload identity patterns.

That layered model is powerful, but it can become confusing if ownership boundaries are unclear.

Security concerns also include:

  • container image trust
  • namespace and admission controls
  • pod-to-pod traffic boundaries
  • minimizing cluster-admin style privileges

Multi-tenant clusters can work, but they require mature governance. Without it, a shared cluster becomes a policy problem disguised as a cost optimization.


20.7 Upgrades, Add-Ons, and Operational Overhead

Kubernetes platforms require lifecycle management.

Even with a managed control plane, teams still face work around:

  • version upgrades
  • add-on compatibility
  • ingress and DNS components
  • autoscaling behavior
  • cluster and node maintenance

This is where many EKS programs either mature or struggle.

A cluster is not a one-time setup task. It is a platform product that needs ownership. If no team owns its upgrade cadence, baseline policies, and standard tooling, the cluster becomes harder to operate over time.

Architects should treat EKS as a platform decision, not just an application deployment choice.


20.8 Observability, Cost, and Platform Fit

EKS requires strong observability because failures can happen at several layers:

  • application layer
  • pod and deployment layer
  • node layer
  • networking and ingress layer
  • cluster control integration layer

That means logging, metrics, tracing, and alerting need to be designed as part of the platform.

Cost also includes more than raw compute. It includes:

  • cluster management overhead
  • operator time
  • supporting tooling and add-ons
  • underutilized node capacity if workloads are packed poorly

The question is not only whether EKS can run the workload. It is whether the organization will operate it well enough to justify the platform cost and complexity.


20.9 EKS Design Patterns and Decision Criteria

EKS is a strong fit when Kubernetes itself is the requirement.

Good reasons include:

  • organizational standardization on Kubernetes
  • need for Kubernetes-native operators or custom resource patterns
  • multi-environment portability where Kubernetes skills and tooling are already mature
  • workload sets that benefit from the broader Kubernetes ecosystem

Weak reasons include:

  • using EKS just because containers are involved
  • assuming EKS is automatically more scalable or more modern than ECS for every use case

An architect checkpoint should ask:

  • what concrete capability requires Kubernetes
  • who owns the cluster platform operationally
  • how multi-tenant boundaries will be enforced
  • how upgrades and add-ons will be managed
  • whether ECS or Fargate would solve the same problem with less operational burden

If those answers are weak, EKS is probably being chosen too early.


20.10 Common Mistakes

  • choosing EKS because Kubernetes is popular rather than because it is truly required
  • assuming a managed control plane removes the need for platform ownership
  • underestimating networking and ingress complexity
  • treating IAM and Kubernetes RBAC as interchangeable instead of layered controls
  • running shared clusters without clear tenancy, namespace, and access boundaries
  • skipping resource requests and limits, leading to unstable scheduling behavior
  • ignoring upgrade and add-on lifecycle planning
  • lacking centralized observability across pods, nodes, and ingress layers
  • moving a simple workload to EKS when ECS or Lambda would be operationally simpler
  • treating Kubernetes knowledge gaps as minor details that can be learned later during production incidents

20.11 Hands-On Tasks

  1. Create or inspect an EKS cluster and identify which components AWS manages versus which your team must operate.
  2. Deploy a simple application using a Deployment and Service.
  3. Expose that application through an ingress or load-balancing pattern and trace the request path.
  4. Define resource requests and limits for the workload and explain why they matter.
  5. Map one application workload to the AWS permissions it needs and describe how workload identity should be handled.
  6. List the baseline observability capabilities your EKS platform would need before production use.
  7. Compare the same workload on EKS versus ECS and explain which platform you would choose.
  8. Describe a realistic reason your organization would adopt EKS and one weak reason it should reject.

20.12 Recap

  • EKS provides a managed Kubernetes control plane, but teams still own significant platform operations work.
  • Kubernetes primitives such as Pods, Deployments, Services, and Ingress shape how workloads run and communicate.
  • EKS adds Kubernetes-level flexibility, but also more networking, identity, upgrade, and observability complexity.
  • Security requires layered thinking across IAM, Kubernetes RBAC, workload identity, and cluster policy.
  • EKS is the right choice when Kubernetes is a genuine requirement, not just when containers are present.
  • Platform ownership and operational maturity determine whether EKS becomes an asset or a burden.

Next: 21: Infrastructure as Code

21: Infrastructure as Code

Infrastructure as Code means defining cloud resources in files instead of creating them by hand in a console. This matters because infrastructure becomes reviewable, repeatable, versioned, and safer to change over time.

This chapter introduces the main AWS approaches, including AWS CloudFormation and the AWS Cloud Development Kit (AWS CDK). You will learn how teams use code-driven infrastructure to reduce manual mistakes, manage environments consistently, and control changes in production.


21.1 Why Infrastructure as Code Matters

Manual cloud changes do not scale well.

Clicking through the console may be fine for learning, but it becomes risky for production systems because it creates:

  • undocumented changes
  • poor repeatability
  • weak reviewability
  • configuration drift between environments
  • harder rollback during incidents

Infrastructure as Code, or IaC, treats infrastructure definitions as versioned source artifacts.

That means VPCs, IAM roles, load balancers, databases, and other resources can be:

  • reviewed before change
  • applied consistently
  • recreated in new environments
  • tracked over time like application code

For a solutions architect, IaC is not only an automation convenience. It is a control mechanism for safety, consistency, and governance.


21.2 CloudFormation and CDK in AWS Workflows

AWS provides native IaC options such as CloudFormation and the AWS Cloud Development Kit, or AWS CDK.

CloudFormation

CloudFormation defines infrastructure declaratively through templates.

This makes desired state explicit and reviewable.

AWS CDK

CDK lets you define infrastructure using programming languages that synthesize into CloudFormation.

This can improve reuse, abstraction, and developer ergonomics when used carefully.

The decision between them often comes down to team preference and complexity level.

Important architect questions include:

  • does the team need direct declarative clarity or higher-level code abstractions
  • how much custom reuse is actually valuable
  • how will generated infrastructure remain understandable during review

The best choice is the one that keeps infrastructure understandable, not merely the one with the most expressive language features.


21.3 Desired State, Stacks, and Change Boundaries

IaC works best when infrastructure is grouped into sensible change units.

In AWS-native workflows, that often means stacks or stack-like boundaries that map to:

  • a service
  • a shared platform component
  • an environment baseline
  • a reusable infrastructure module

The point is to define change boundaries that are easy to reason about.

If one stack controls everything in the estate, change risk becomes too large. If every tiny resource is isolated without a design reason, coordination becomes messy.

Architects should think about:

  • what changes together
  • what should be deployed independently
  • what shared resources need separate lifecycle ownership

Good boundaries reduce blast radius and make review easier.


21.4 Reviewability, Change Sets, and Safe Delivery

IaC improves safety only if changes are reviewed and applied predictably.

Important practices include:

  • version control for all infrastructure definitions
  • pull request review before deployment
  • change previews or change sets where supported
  • separate approval controls for higher-risk environments

This matters because the most dangerous infrastructure changes are often syntactically valid. The risk is semantic.

For example:

  • widening an IAM policy
  • replacing a database resource unexpectedly
  • changing a route or security group that breaks traffic flow

Safe IaC delivery depends on making those changes visible before they are applied.


21.5 Drift, State, and Environment Consistency

One of the biggest reasons to use IaC is to avoid drift.

Drift happens when the real environment no longer matches the declared source of truth.

Common causes include:

  • manual console edits
  • out-of-band emergency changes never codified afterward
  • separate teams changing shared resources without coordination

Drift creates operational risk because nobody is fully sure what the current environment actually is.

IaC does not prevent all drift automatically, but it gives you a model for detecting and correcting it.

Architecturally, the goal should be clear:

  • code is the intended source of truth
  • emergency manual changes are rare and must be reconciled back into code quickly
  • environments should differ deliberately, not accidentally

21.6 Reuse, Parameters, and Environment Strategy

Infrastructure definitions usually need some reuse across environments, but too much flexibility can make them harder to understand.

Useful reuse patterns include:

  • shared constructs for repeated service patterns
  • parameterization for region, environment name, or sizing
  • common baseline stacks for logging, networking, or security controls

The danger is over-abstraction.

If an IaC module becomes so generic that no reviewer can tell what it actually creates, the code is less safe even if it is technically reusable.

Environment strategy also matters.

You should decide:

  • which settings vary by environment
  • which resources are shared versus isolated
  • whether environments live in separate accounts
  • how secrets and sensitive values are provided at deploy time

IaC should reduce ambiguity, not hide it behind abstraction layers.


21.7 Security, Compliance, and Policy Guardrails

IaC is one of the best places to enforce security and compliance early.

Instead of catching problems after deployment, teams can review or validate infrastructure definitions for issues such as:

  • public exposure where private placement was expected
  • overly broad IAM permissions
  • missing encryption settings
  • lack of tagging or logging controls

This is where policy guardrails become valuable.

The more important the environment, the more infrastructure changes should be checked for compliance and security expectations before deployment.

Architects should treat IaC pipelines as control points for governance, not only as convenience wrappers around deployment commands.


21.8 Testing, Rollback, and Failure Handling

Infrastructure changes can fail in ways that application developers do not always expect.

Examples include:

  • resource creation failures due to quotas or naming conflicts
  • replacement of resources that should have been preserved
  • partial success where some dependent resources were updated and others were not

That is why IaC workflows need:

  • testing in lower environments
  • careful review of destructive changes
  • rollback planning for stateful resources
  • awareness that not every rollback is clean or risk-free

The production mindset is simple: infrastructure changes are deployments. They need the same seriousness as application releases, and sometimes more.


21.9 Infrastructure as Code Design Patterns and Decision Criteria

IaC should become the default operating model for durable AWS infrastructure.

Strong patterns include:

  • treat infrastructure definitions as first-class source code
  • keep stack boundaries understandable and ownership clear
  • promote reviewed changes through environments predictably
  • encode guardrails and validation close to the deployment path

An architect checkpoint should review:

  • whether the code clearly represents intended infrastructure
  • whether change scope is understandable before deploy
  • how manual changes are prevented or reconciled
  • how shared resources are governed
  • how secrets, approvals, and destructive operations are controlled

If the answers are unclear, the organization may have automation but not yet true infrastructure discipline.


21.10 Common Mistakes

  • treating the console as the primary production change path after adopting IaC
  • over-abstracting templates or constructs until reviewers cannot understand the actual resources
  • putting too much unrelated infrastructure into one large deployment unit
  • allowing environment drift to accumulate after manual fixes or emergencies
  • ignoring change previews and reviewing only syntax rather than infrastructure impact
  • assuming rollback is always safe even for stateful resources
  • failing to encode security and policy checks into the workflow
  • parameterizing everything until environments become inconsistent and difficult to reason about
  • lacking clear ownership of shared infrastructure stacks
  • thinking infrastructure code quality matters less than application code quality

21.11 Hands-On Tasks

  1. Define a simple AWS resource stack using CloudFormation or CDK.
  2. Put that definition under version control and review the resulting change before deployment.
  3. Deploy the stack to a lower environment and inspect the created resources.
  4. Make one intentional change and review the resulting change set or diff.
  5. Introduce a manual console change and explain why that creates drift.
  6. Refactor one repeated pattern into a reusable abstraction, then explain where further abstraction would become excessive.
  7. Identify one security guardrail your infrastructure pipeline should enforce automatically.
  8. Describe how you would separate shared platform infrastructure from one application's infrastructure.

21.12 Recap

  • Infrastructure as Code turns infrastructure into versioned, reviewable, repeatable source artifacts.
  • CloudFormation and CDK both support AWS-native IaC workflows with different trade-offs around abstraction and clarity.
  • Safe IaC depends on change boundaries, reviewability, drift control, and environment consistency.
  • IaC pipelines are strong places to enforce security, compliance, and deployment guardrails.
  • Infrastructure changes need testing, approval, and rollback thinking just like application releases.
  • The goal is not simply automation. The goal is controlled, understandable, reproducible infrastructure change.

Next: 22: CI/CD on AWS

22: CI/CD on AWS

Continuous Integration and Continuous Delivery (CI/CD) is the practice of building, testing, and deploying software through automated pipelines. In AWS, this helps teams move faster while still applying checks, approvals, and rollback strategies.

This chapter explains how AWS supports delivery workflows from source change to production release. You will learn why pipeline stages matter, how automation reduces risky manual steps, and what controls are needed to make releases secure, observable, and dependable.


22.1 Why CI/CD Matters

Manual releases do not scale well.

They are slow, inconsistent, and hard to audit. They also make rollback and environment drift more likely because the release process depends on people remembering steps correctly under pressure.

Continuous integration and continuous delivery, usually shortened to CI/CD, improves this by making software delivery:

  • repeatable
  • testable
  • observable
  • easier to review
  • safer to promote across environments

On AWS, CI/CD is not only about pushing application code. It often includes infrastructure changes, container image publishing, policy checks, and deployment approval gates.

For a solutions architect, CI/CD matters because delivery speed without safety is reckless, and safety without automation becomes slow and fragile.


22.2 The Core Pipeline Stages

Most delivery pipelines follow a similar shape even if tooling differs.

Typical stages include:

  • source retrieval
  • build
  • test
  • package or artifact creation
  • deployment to one or more environments
  • verification and possible promotion

The exact implementation changes by workload type.

Examples:

  • a Lambda workload may build and package functions plus infrastructure templates
  • a containerized application may build an image, push to ECR, and deploy to ECS or EKS
  • an infrastructure change may synthesize, validate, and deploy CloudFormation or CDK artifacts

The architect's job is to make sure each stage answers a clear question before the next stage proceeds.


22.3 AWS Services Commonly Used in Delivery Pipelines

AWS provides several services that can participate in delivery workflows.

Common examples include:

  • CodePipeline for orchestrating pipeline stages
  • CodeBuild for build and test execution
  • CodeDeploy for certain deployment patterns
  • ECR for container artifact storage
  • CloudFormation or CDK deployment steps for infrastructure changes

Many teams also integrate AWS pipelines with external source platforms and testing systems.

The right design does not require every AWS delivery service. What matters is a clean pipeline that can:

  • retrieve trusted source
  • build artifacts reproducibly
  • apply tests and policy checks
  • deploy through controlled stages
  • show what changed and whether it succeeded

Tool count is less important than delivery discipline.


22.4 Artifact Integrity and Build Reproducibility

Pipelines should create trusted artifacts, not just run commands.

Important questions include:

  • what exact source revision was built
  • what dependency versions were used
  • what artifact was produced
  • where that artifact is stored
  • whether later environments deploy the same artifact or a rebuilt variant

Strong pipelines usually build once and promote the same artifact forward.

Examples:

  • one container image digest moves from test to production
  • one Lambda package is validated and then promoted unchanged
  • one reviewed infrastructure artifact moves through approved environments

This reduces ambiguity and makes incident analysis easier. If each environment rebuilds separately, you risk hidden artifact drift.


22.5 Deployment Strategies and Safety Controls

Not every deployment should replace everything at once.

Safe delivery may use patterns such as:

  • rolling deployment
  • blue-green deployment
  • canary release
  • staged promotion from lower environments to production

The right choice depends on workload type and failure tolerance.

Architects should ask:

  • how quickly a bad release must be stopped
  • whether old and new versions can coexist temporarily
  • what rollback actually means for the workload
  • what health checks prove the release is safe

Deployment automation is only as safe as its verification logic. If the pipeline deploys quickly but cannot detect a bad release, automation has merely accelerated risk.


22.6 Secrets, Permissions, and Environment Isolation

Delivery pipelines often have broad access if they are not designed carefully.

That makes them a high-value security target.

You should review:

  • what permissions the pipeline has in each environment
  • how secrets such as tokens and deployment credentials are stored
  • whether production deployments are isolated from lower-environment credentials and roles
  • whether one compromised build step could affect every environment

Good practice includes:

  • least-privilege roles for pipeline stages
  • separate roles or accounts for different environments
  • managed secret storage instead of plaintext credentials in pipeline definitions
  • clear approval boundaries for higher-risk changes

CI/CD is part of the security architecture, not only an engineering convenience.


22.7 Validation, Policy Checks, and Human Approval Gates

Automation does not mean humans disappear from the process. It means humans intervene at the right control points.

Common validation controls include:

  • unit and integration tests
  • infrastructure validation and policy checks
  • image scanning
  • static analysis and configuration checks
  • smoke tests after deployment

For some changes, especially in production, human approvals are still valuable.

The key is to use approvals for meaningful risk boundaries, not to slow every harmless change with bureaucracy.

A good pipeline is fast for safe changes and deliberate for high-impact ones.


22.8 Observability, Auditability, and Rollback Readiness

You should be able to answer these questions quickly for any release:

  • what version was deployed
  • when it was deployed
  • by which pipeline execution
  • what tests and checks passed
  • how to revert if necessary

That means CI/CD systems need strong logging, traceability, and deployment history.

Rollback readiness also matters. Some systems can roll back quickly by redeploying a previous artifact. Others involve state changes, schema changes, or external side effects that make rollback more complex.

Production-safe delivery pipelines acknowledge that nuance. They do not assume rollback is effortless in every system.


22.9 CI/CD Design Patterns and Decision Criteria

Strong AWS delivery pipelines usually follow a few durable principles:

  • build once and promote trusted artifacts
  • separate lower-risk and higher-risk environments clearly
  • automate verification as early as possible
  • keep deployment identity and audit history explicit
  • use environment-specific roles and secrets intentionally

An architect checkpoint should review:

  • whether the pipeline reflects the actual release risk of the system
  • whether the same artifact moves forward or is rebuilt repeatedly
  • whether infrastructure and application delivery are coordinated safely
  • whether failure signals stop promotion automatically where appropriate
  • whether operators can quickly understand and revert a release if needed

If the pipeline is fast but opaque, it is not mature.


22.10 Common Mistakes

  • treating CI/CD as only a build script instead of a controlled delivery system
  • rebuilding artifacts separately in each environment instead of promoting one trusted artifact
  • giving pipeline roles excessive permissions across all environments
  • storing secrets directly in pipeline configuration or source code
  • skipping post-deployment verification and relying only on a successful deploy command
  • using manual production changes outside the pipeline while assuming the pipeline remains the source of truth
  • adding approval gates everywhere instead of only at meaningful risk boundaries
  • automating deployment without clear rollback and release visibility
  • ignoring infrastructure changes as part of the delivery workflow
  • assuming faster deployment always means better delivery without measuring safety and recoverability

22.11 Hands-On Tasks

  1. Sketch a pipeline for one AWS workload from source commit to production deployment.
  2. Identify which artifact the pipeline produces and how that artifact is tracked across environments.
  3. Add a validation stage and explain what risk it reduces.
  4. Define which stages should run automatically and where human approval is justified.
  5. Separate the permissions needed for lower-environment deployment from production deployment.
  6. Describe how the pipeline should surface deployment history and rollback options.
  7. Explain how the same pipeline would handle both application code changes and infrastructure code changes.
  8. Compare a direct manual release process with the controlled pipeline you designed and identify the operational risks removed.

22.12 Recap

  • CI/CD makes software and infrastructure delivery repeatable, testable, and auditable.
  • AWS delivery workflows often combine services such as CodePipeline, CodeBuild, ECR, and CloudFormation or CDK deployment steps.
  • Strong pipelines build trusted artifacts once and promote them forward predictably.
  • Deployment safety depends on verification, permissions, environment isolation, and meaningful approval boundaries.
  • Observability and rollback readiness are part of delivery design, not afterthoughts.
  • A mature pipeline optimizes both speed and control instead of sacrificing one for the other.

Next: 23: CloudWatch

23: CloudWatch

Amazon CloudWatch is a core observability service for AWS workloads. It collects and works with metrics, logs, alarms, dashboards, and events so operators can see what a system is doing and respond when something goes wrong.

This chapter explains why monitoring is an active part of running production systems, not just a reporting tool. You will learn how CloudWatch helps teams detect failures, track performance, and build operational awareness around applications and infrastructure.


23.1 Why CloudWatch Matters

You cannot operate a production system you cannot observe.

In AWS, workloads are distributed across managed services, networks, compute platforms, queues, and storage systems. Failures rarely announce themselves clearly. Instead, they show up as rising latency, retry storms, queue buildup, elevated error rates, throttling, or missing business events. CloudWatch is one of the main services AWS gives you to detect those signals.

CloudWatch matters because it helps answer operational questions such as:

  • Is the system healthy right now?
  • Is performance degrading?
  • Did a deployment increase errors?
  • Are requests being throttled?
  • Is a backlog growing faster than workers can drain it?
  • Did something stop running entirely?

This is not only about incident response. Good monitoring improves design quality. When architects think early about what must be measured, they often expose weak assumptions in scaling, failure handling, and ownership boundaries.


23.2 What CloudWatch Actually Provides

CloudWatch is not one single feature. It is a set of observability capabilities that work together.

The most important building blocks are:

  • metrics for numeric time-series data such as CPU usage, request count, duration, and error count
  • logs for application, platform, and service-generated text events
  • alarms for threshold- or condition-based alerting
  • dashboards for visualizing operational state
  • events and automation hooks that can trigger remediation or downstream workflows

This distinction matters. A metric tells you that something changed. A log helps explain why. An alarm decides when the change is important enough to act on.

In practice, mature monitoring combines all three. If your team only has logs, you will struggle to see trends. If you only have metrics, root-cause analysis becomes slow. If you have no alarms, the system may be observable but still operationally unmanaged.


23.3 Metrics, Dimensions, and Resolution

Metrics are numeric data points published over time. AWS services emit many built-in metrics automatically. EC2 publishes host-level metrics, Application Load Balancers publish request and latency metrics, Lambda publishes invocation and error metrics, and SQS publishes queue depth and age metrics.

Metrics are usually scoped with dimensions. A dimension is metadata that identifies the resource or context for the measurement.

Examples:

  • EC2 CPU utilization by instance ID
  • Lambda errors by function name
  • ALB request count by load balancer and target group

Dimensions matter because they define what you can isolate operationally. If you aggregate everything too early, you may hide failures in a single resource. If you fragment too aggressively, you may create noisy dashboards and alarms that no one trusts.

CloudWatch also supports different metric resolutions. Standard-resolution metrics are sufficient for many workloads, but high-resolution metrics can be useful for latency-sensitive or bursty systems where a one-minute view hides operational spikes.

The design question is not whether more data is better. The design question is whether the chosen metric granularity helps someone make a better operational decision.


23.4 Logs and Log Groups

Logs capture detailed events rather than numeric summaries. They are essential when you need to inspect requests, application behavior, exceptions, or state transitions.

CloudWatch Logs organizes records into log groups and log streams:

  • a log group is the retention and access boundary for a logical source
  • a log stream is a sequence of events from a specific producer, such as a Lambda execution environment or an EC2 agent source

Common log sources include:

  • Lambda function output
  • VPC Flow Logs
  • API Gateway execution logs
  • ECS container logs
  • application logs shipped from EC2 or on-premises hosts through the CloudWatch agent

Log retention matters. Keeping everything forever is expensive and operationally lazy. Retention should reflect investigation needs, compliance needs, and cost. A common pattern is short retention for verbose debug-style logs and longer retention for security-relevant or audit-supporting data.

Teams also need logging discipline:

  • structure logs where possible, usually as JSON
  • avoid logging secrets, tokens, or personal data
  • include request IDs, correlation IDs, or tenant identifiers when appropriate
  • log meaningful state changes, not only stack traces

Without those habits, CloudWatch Logs becomes a storage bucket for noise rather than a useful operational tool.


23.5 Alarms and Alert Design

An alarm turns observation into action. It evaluates a metric or expression and changes state when a condition is met.

Alarms sound simple, but alert design is one of the places where operational maturity is most visible.

Poor alarms create two bad outcomes:

  • alert fatigue, where engineers ignore alarms because they are noisy or low-value
  • silent failure, where nothing fires because thresholds were chosen without understanding system behavior

Useful alarm design usually follows these principles:

  • alert on symptoms users or operators care about
  • distinguish urgent paging alerts from informational notifications
  • use evaluation periods that smooth short-lived noise without masking real incidents
  • combine metrics when a single threshold is misleading
  • review alarms after incidents and after architecture changes

For example, a high CPU alarm on one EC2 instance may not matter if Auto Scaling is already replacing or distributing load correctly. A sustained increase in ALB 5xx errors or Lambda throttles is usually much more actionable.

Alarm actions can notify an Amazon SNS topic, trigger automation, or integrate with incident management workflows. The point is not simply to know something is wrong. The point is to route the right signal to the right responder at the right urgency level.


23.6 Dashboards, Service Views, and Operational Context

Dashboards help teams see related signals together.

A useful dashboard is not a random collection of charts. It should reflect an operational question or an ownership boundary.

Examples:

  • a web application dashboard showing request rate, latency, 4xx and 5xx errors, target health, and database load
  • a serverless workflow dashboard showing Lambda duration, error count, SQS queue depth, and DLQ activity
  • a platform dashboard showing deployment frequency, alarm state, and infrastructure saturation across environments

Good dashboards do three things:

  • show system state at a glance
  • help on-call engineers narrow the problem area quickly
  • expose trends that suggest scaling, tuning, or architectural work is needed

Dashboards are most effective when they reflect service relationships rather than organizational guesswork. If one team owns an API, a queue, and a Lambda consumer path, the dashboard should show the end-to-end chain, not only one isolated service.


23.7 Logs Insights, Queries, and Troubleshooting Flow

CloudWatch Logs becomes much more powerful when teams query it instead of manually scrolling through raw events.

CloudWatch Logs Insights lets you search and aggregate log data to answer questions such as:

  • Which errors increased in the last hour?
  • Which tenant or path is producing the highest latency?
  • Did failures begin right after a deployment?
  • Are timeouts concentrated in one dependency?

This is where structured logging pays off. If logs include fields such as request ID, status code, user identifier, route, or dependency name, you can group and filter on those values instead of relying on free-text guesswork.

A common troubleshooting workflow looks like this:

  1. An alarm fires on an elevated error or latency metric.
  2. The dashboard narrows the problem to a service or dependency.
  3. Logs Insights finds the affected routes, tenants, or failure classes.
  4. Engineers correlate the timing with deployments, config changes, or dependency issues.

This metric-to-log workflow is one of the core operational habits CloudWatch supports.


23.8 CloudWatch in a Solutions Architect Design Review

When reviewing an AWS design, architects should ask observability questions before the workload ships.

Useful review questions include:

  • What are the service-level indicators for this workload?
  • Which failures are detectable within minutes?
  • How will on-call engineers know whether the problem is demand, dependency, configuration, or deployment related?
  • What metrics prove the scaling model is working?
  • Where are logs stored, how long are they retained, and who can access them?
  • Which alarms page humans, and which only create tickets or notifications?

This review matters because observability gaps are cheaper to fix before launch than after an outage.

A strong mental model is to monitor across four layers:

  • business signals, such as order completion or payment success rate
  • application signals, such as latency and error rate
  • infrastructure or managed service signals, such as CPU, concurrency, queue age, or storage pressure
  • security and audit signals, which are expanded further in later chapters with CloudTrail, Config, and related services

If a system is only monitored at the infrastructure layer, teams often miss failures that affect users but not host health.


23.9 Cost, Scale, and Retention Trade-Offs

Observability is not free.

CloudWatch cost can grow through:

  • custom metrics
  • high-cardinality dimensions
  • large log volumes
  • long retention periods
  • alarm counts and dashboard usage in large environments

That does not mean you should under-monitor. It means monitoring should be designed deliberately.

Typical cost-control practices include:

  • publishing only metrics that lead to operational decisions
  • avoiding unnecessary per-request custom metrics with extreme cardinality
  • setting log retention instead of accepting indefinite storage
  • separating verbose debug logs from durable operational or security logs
  • aggregating where detail is not operationally useful

There is also a scaling trade-off. Large environments often need naming conventions, tagging, centralized dashboard patterns, and account-level logging standards. Without those, teams produce fragmented observability that works for one service but fails at organizational scale.


23.10 Common Mistakes

  • treating CloudWatch as a dashboard service only instead of an end-to-end monitoring system
  • creating alarms on every metric without deciding which ones require human action
  • relying on host metrics while ignoring application latency, error rates, and business outcomes
  • keeping logs indefinitely without retention rules or cost review
  • logging secrets, credentials, tokens, or personal data
  • publishing custom metrics with high-cardinality dimensions that are expensive and hard to use
  • building dashboards that show many charts but answer no operational question
  • waiting until after production incidents to decide what should have been monitored

23.11 Hands-On Tasks

  1. Open CloudWatch and identify built-in metrics for EC2, Lambda, and SQS.
  2. Choose one workload pattern, such as a web API or asynchronous worker, and define five metrics you would track first.
  3. Write down one alarm that should page an engineer and one that should only create a ticket.
  4. Describe a log retention policy for application logs, security-relevant logs, and short-lived debug logs.
  5. Explain how you would investigate a sudden increase in API latency using metrics, dashboards, and logs together.

23.12 Recap

CloudWatch gives AWS workloads their basic operational visibility. Metrics show trends and health signals, logs explain behavior in detail, alarms decide when action is required, and dashboards provide shared context for operators. Good CloudWatch design is not about collecting everything. It is about collecting the signals that help teams detect, diagnose, and respond to real problems quickly and safely.

Next: CloudTrail and AWS Config

24: CloudTrail and AWS Config

AWS CloudTrail and AWS Config both help you understand change in your AWS environment, but they answer different questions. CloudTrail records API activity, while Config records the state of resources and how that state changes over time.

This chapter explains why both services are important for security and operations. You will learn how they support auditing, investigation, governance, and drift detection, and why production environments need clear records of both actions and configuration history.


24.1 Why CloudTrail and AWS Config Matter

Production AWS environments change constantly.

Roles are assumed, policies are edited, instances are launched, security groups are modified, buckets are reconfigured, and encryption settings are updated. If you cannot answer who changed something, when it changed, and what the previous state was, you are operating with weak control.

CloudTrail and AWS Config exist to solve two related but different problems:

  • CloudTrail records API activity and account actions.
  • AWS Config records resource configuration state and how that state changes over time.

This distinction is important during incidents. If a bucket became public, CloudTrail helps identify the action that changed it. AWS Config helps show the resulting configuration state and often what it was before the change.

Together, these services support auditability, incident response, change review, and governance at scale.


24.2 What CloudTrail Captures

CloudTrail records AWS API activity in your account.

That usually includes:

  • console actions
  • CLI commands
  • SDK calls from applications and automation
  • service-initiated actions on your behalf in some scenarios

Each event can include details such as:

  • who performed the action
  • which API was called
  • when the action happened
  • the source IP address
  • request parameters
  • the affected resource when applicable

This makes CloudTrail one of the core sources for security and operational forensics.

For example, if an IAM policy suddenly becomes more permissive, CloudTrail can help answer whether the change came from a person in the console, a CI/CD role, or an application using an access key or assumed role.

CloudTrail does not tell you whether the resulting configuration is good. It tells you that an action happened and gives you evidence around that action.


24.3 Management Events, Data Events, and Insights

CloudTrail event categories matter because they affect both coverage and cost.

Management events

These track control-plane actions such as creating a role, modifying a security group, or deleting a trail.

Management events are the baseline for most accounts because they show administrative and configuration activity.

Data events

These track operations against resource data paths, such as object-level activity in S3 or invocation-level activity in Lambda.

Data events can be extremely valuable, but they can also create large event volumes. They are usually enabled selectively for sensitive resources or workloads where object- or function-level auditability matters.

CloudTrail Insights

CloudTrail Insights highlights unusual patterns in API activity, such as sudden spikes in write actions or error rates. It can help surface suspicious or unexpected control-plane behavior, but it is not a replacement for strong logging, detection engineering, or deliberate security monitoring.

The design lesson is straightforward: collect enough detail to support real investigations, but do not assume every event category must be enabled everywhere without cost and signal review.


24.4 Trails, Storage, and Organization Coverage

A trail controls how CloudTrail events are delivered and stored.

Typical design choices include:

  • whether the trail covers one region or all regions
  • whether it applies to one account or an AWS Organizations structure
  • which event categories it records
  • where the logs are stored

For production environments, multi-region coverage is usually the safer baseline because attackers and operators do not always stay inside the region you expected.

Organization trails are especially important in multi-account environments. Without them, each account may have inconsistent audit coverage, which weakens incident response and governance.

You should also think about log destination design:

  • centralize trails where practical
  • protect the destination with strong access controls
  • enable integrity validation where required
  • design retention around audit and compliance needs

CloudTrail is most valuable when it is hard to tamper with and easy for the right responders to access.


24.5 What AWS Config Captures

AWS Config focuses on resource configuration state.

It records configuration items for supported resources and tracks how those configurations change over time.

That means Config can help answer questions such as:

  • Is this bucket encrypted right now?
  • When did this security group rule change?
  • Which resources are noncompliant with our tagging requirement?
  • What did this role or subnet configuration look like yesterday?

Unlike CloudTrail, which centers on API activity, Config centers on the resulting resource state and compliance view.

This makes it useful for drift detection and governance. If a resource gradually moves away from the approved baseline, Config can surface that even if no one is currently reviewing the resource manually.


24.6 Recorders, Rules, and Compliance Views

Config works through a few important concepts.

Recorder

The recorder tracks supported resource changes in the account and region.

Configuration history

Config stores historical snapshots and change relationships so teams can inspect how a resource evolved over time.

Rules

Config rules evaluate whether resources comply with desired conditions.

Examples:

  • S3 buckets should not allow public read access.
  • EBS volumes should be encrypted.
  • Security groups should not expose sensitive ports to the internet.
  • Required tags should exist on resources.

Rules can be AWS-managed or custom. The important point is that Config turns governance from a periodic spreadsheet exercise into continuous evaluation.

That does not mean every rule should alert or auto-remediate. Rules need ownership, risk-based prioritization, and operational follow-through.


24.7 How CloudTrail and Config Work Together

These services are complementary, not interchangeable.

CloudTrail answers:

  • who did what
  • which API call occurred
  • when the call happened
  • from where the action was initiated

Config answers:

  • what the resource configuration is now
  • how the resource looked before
  • whether the resource is compliant with defined expectations

A common incident workflow looks like this:

  1. An engineer sees that a security control failed.
  2. AWS Config shows the resource is noncompliant and when the state changed.
  3. CloudTrail identifies the principal, API call, and session context that caused the change.
  4. Teams restore the desired state and review whether stronger preventive controls are needed.

This pairing is one of the core governance patterns in AWS.


24.8 Security, Governance, and Incident Response Patterns

CloudTrail and Config become much more valuable when they are designed as part of a broader control system.

Common patterns include:

  • centralized logging accounts for audit data
  • organization-wide trails and Config aggregation
  • alerting on sensitive actions such as disabling logging, changing key policies, or opening public access paths
  • regular review of noncompliant resources and repeat offenders
  • automated remediation for low-risk, well-understood configuration drift

Architects should be careful with automatic remediation. It is useful for deterministic corrections, such as reapplying a missing tag or closing a clearly forbidden port, but it can be dangerous if the rule logic is broad or if business exceptions are not modeled correctly.

These tools support governance, but they do not replace access control, deployment discipline, or review processes.


24.9 Solutions Architect Checkpoint

When reviewing an AWS environment, ask:

  • Are CloudTrail logs enabled for all relevant regions and accounts?
  • Are important data events enabled where object-level or invocation-level auditability matters?
  • Is audit log storage centralized and protected from casual tampering?
  • Is AWS Config recording the resources that matter most for governance?
  • Which compliance rules are informative only, and which are tied to operational action?
  • Can responders quickly correlate a bad resource state with the action that caused it?

The checkpoint is not about enabling every possible feature. It is about making sure the environment supports accountability and investigation when something changes unexpectedly.


24.10 Common Mistakes

  • assuming CloudTrail alone is enough without any resource-state history or compliance view
  • enabling CloudTrail only in one region and missing activity elsewhere
  • failing to centralize or protect audit logs adequately
  • turning on high-volume data events broadly without cost review or clear investigative need
  • treating Config rules as complete governance without assigning owners or remediation paths
  • enabling Config without deciding which resources and controls matter most
  • ignoring repeat noncompliance because alerts are too noisy or poorly prioritized
  • failing to correlate CloudTrail and Config during security investigations

24.11 Hands-On Tasks

  1. Explain the difference between a CloudTrail management event and a data event.
  2. Pick one sensitive AWS resource type and describe whether data events should be enabled for it.
  3. Define three AWS Config rules you would enforce in a production account.
  4. Describe how you would investigate an unexpected security group change using both CloudTrail and Config.
  5. Sketch an organization-level design for storing audit logs from multiple AWS accounts.

24.12 Recap

CloudTrail records account and API activity, while AWS Config records resource configuration state and compliance over time. CloudTrail helps identify who made a change and how. Config helps show what changed and whether the new state violates expectations. Together, they provide the audit and drift-detection foundation needed for secure, governed AWS environments.

Next: 25: KMS, Secrets Manager, and Parameter Store

25: KMS, Secrets Manager, and Parameter Store

Applications need encryption keys, secrets, and configuration values, but they should not store them directly in code. AWS Key Management Service (AWS KMS), AWS Secrets Manager, and AWS Systems Manager Parameter Store help teams handle sensitive data in safer and more manageable ways.

This chapter explains what each service is for and why mixing them up causes bad designs. You will learn how they are used for encryption, credentials, tokens, and configuration, and how the right choice improves security, rotation, and operational control.


25.1 Why These Services Matter

Every AWS workload eventually faces the same questions:

  • How do we encrypt data?
  • Where do we store credentials?
  • How do applications read configuration safely?
  • How do we rotate secrets without changing code manually?

Weak answers lead to familiar failures: secrets committed into repositories, plaintext passwords in environment files, inconsistent encryption standards, and unclear ownership of sensitive values.

AWS separates these concerns intentionally:

  • KMS manages encryption keys and cryptographic policy controls.
  • Secrets Manager stores and rotates secrets.
  • Parameter Store stores configuration values and can also hold sensitive parameters.

If you use one service for the wrong purpose, you often get either unnecessary complexity or insufficient control.


25.2 AWS KMS Fundamentals

AWS Key Management Service, or KMS, manages cryptographic keys used across many AWS services and custom applications.

KMS matters because most teams should not build low-level key management themselves. Key creation, access control, auditability, rotation policy, and service integration are all security-critical.

KMS keys are commonly used for:

  • S3 object encryption
  • EBS volume encryption
  • RDS encryption at rest
  • encrypting application data
  • protecting secrets stored in other AWS services

KMS does not usually store your business secrets directly. It stores and governs the keys that encrypt or decrypt data.

That distinction is important. A key and a secret are not the same thing. A key protects data cryptographically. A secret is itself sensitive data, such as a database password, API token, or signing credential.


25.3 KMS Keys, Policies, and Usage Model

KMS design is built around access control and usage context.

Important concepts include:

  • customer managed keys, which you control more directly
  • AWS managed keys, which AWS services create and manage for you in simpler scenarios
  • key policies and IAM permissions that determine who can use a key and how
  • envelope encryption, where a data key encrypts the payload and the KMS key protects that data key

Customer managed keys are common when you need clear ownership, fine-grained control, explicit policy review, or cross-service consistency. AWS managed keys are simpler but less customizable.

Architecturally, key access should usually be granted to roles and services that need it, not to broad human identities. If many people can use a production key directly, key governance is already too loose.

You should also distinguish between permissions to administer a key and permissions to use a key. Those are different responsibilities.


25.4 Secrets Manager Fundamentals

Secrets Manager is designed for secret values that applications or operators need to retrieve securely.

Typical examples include:

  • database credentials
  • API tokens
  • third-party service keys
  • application signing secrets
  • credentials that need regular rotation

Secrets Manager is most valuable when the secret lifecycle matters, not only secret storage.

That lifecycle includes:

  • secure creation
  • controlled access
  • retrieval by authorized applications
  • version tracking
  • rotation

In other words, Secrets Manager is not just a hidden key-value store. It is an operational workflow for secrets.


25.5 Rotation and Application Integration

Secret rotation is one of the strongest reasons to use Secrets Manager.

For secrets that support automated rotation, the service can update the secret on a defined schedule and coordinate the lifecycle needed for applications or databases.

Rotation reduces the damage window if a credential is exposed. It also reduces the long-term operational risk of forgotten static credentials that remain valid for years.

Applications should retrieve secrets at runtime through approved identities such as:

  • Lambda execution roles
  • EC2 instance roles
  • ECS task roles
  • EKS workload identities or comparable patterns

Avoid copying secrets into code, AMIs, container images, or long-lived local files. Those shortcuts usually survive far longer than intended.

There is still an application design question: how often should a secret be fetched? Fetching every request may be wasteful. Caching forever defeats rotation. Good designs use bounded caching with refresh logic appropriate to the rotation model and outage tolerance.


25.6 Parameter Store Fundamentals

Systems Manager Parameter Store is a configuration store for application and infrastructure parameters.

It is commonly used for:

  • environment configuration values
  • feature flags or operational toggles
  • service endpoint settings
  • AMI identifiers and deployment parameters
  • sensitive values stored as secure strings in simpler scenarios

Parameter Store is often a good fit when you need hierarchical configuration and do not require the richer rotation and secret-management lifecycle that Secrets Manager provides.

Examples:

  • /prod/payments/api/base-url
  • /shared/network/vpc-id
  • /sandbox/app/log-level

That path-based organization helps teams manage configuration consistently across environments.


25.7 How to Choose Between Secrets Manager and Parameter Store

The services overlap, but they are not interchangeable in intent.

Choose Secrets Manager when:

  • the value is a true secret
  • rotation matters
  • secret versioning and lifecycle controls matter
  • the operational cost of stale credentials is high

Choose Parameter Store when:

  • the value is configuration rather than a credential
  • you need hierarchical naming and broad environment parameter management
  • secret rotation is not the primary requirement
  • you want a simpler configuration distribution model

Use KMS alongside both when encryption and access control of the underlying values is required.

The mistake to avoid is flattening everything into a single generic store. Configuration, secrets, and keys have different ownership models and different operational consequences.


25.8 Encryption, Access Control, and Auditability

All three services are only as strong as their access model.

Good practices include:

  • granting read access only to workload identities that truly need the value
  • separating administrative privileges from consumption privileges
  • using least-privilege IAM and key policies
  • reviewing who can decrypt, retrieve, or modify sensitive entries
  • logging and auditing changes and access patterns where relevant

Encryption at rest is important, but it is not enough. A value can be encrypted perfectly and still be exposed if too many roles can decrypt or retrieve it.

Architects should also think about failure modes. If an application depends on retrieving secrets or parameters at startup, what happens if IAM is misconfigured or a regional dependency becomes unavailable? Security design and availability design intersect here.


25.9 Solutions Architect Decision Patterns

During design review, ask:

  • What values are keys, what values are secrets, and what values are just configuration?
  • Which identities need read access, and which identities need administrative control?
  • Does any application still rely on hard-coded credentials or static local config files?
  • Which secrets should rotate automatically?
  • Are cross-account or cross-environment access patterns intentional and reviewable?
  • Can the workload tolerate temporary failure to retrieve a secret or parameter?

This checkpoint often reveals hidden risk. Many teams think they have a secret-management strategy when they really have a collection of encrypted plaintext values with unclear ownership.


25.10 Common Mistakes

  • storing secrets directly in source code, .env files, AMIs, or container images
  • using broad IAM permissions that let many roles decrypt or retrieve sensitive values
  • treating KMS as if it were a full secret store instead of a key-management service
  • storing large volumes of application configuration in ad hoc files rather than in a managed parameter hierarchy
  • choosing Parameter Store for secrets that require frequent rotation and tighter lifecycle management
  • enabling encryption but ignoring who can actually read the decrypted value
  • failing to separate production secret access from lower-environment access
  • rotating secrets without making sure applications can refresh them safely

25.11 Hands-On Tasks

  1. Classify these items as key, secret, or configuration value: an S3 encryption key, a database password, an API endpoint URL, and a JWT signing secret.
  2. Design a Parameter Store hierarchy for one application across sandbox, staging, and production.
  3. Explain when Secrets Manager is a better choice than Parameter Store for application credentials.
  4. Describe who should be allowed to administer a KMS key versus who should only use it.
  5. Sketch a safe secret-retrieval pattern for a Lambda function or containerized service.

25.12 Recap

KMS manages encryption keys, Secrets Manager manages secret values and their lifecycle, and Parameter Store manages configuration values with optional secure storage for simpler sensitive data. Strong AWS designs distinguish among these concerns instead of forcing one service to solve every problem. The result is clearer ownership, safer access control, and less exposure of sensitive information in application code and operations.

Next: 26: WAF, Shield, and Cognito

26: WAF, Shield, and Cognito

Internet-facing applications need protection at both the network edge and the user identity layer. AWS Web Application Firewall (AWS WAF), AWS Shield, and Amazon Cognito each solve a different part of that problem.

This chapter explains how these services fit into a practical security architecture. You will learn how AWS WAF filters web requests, how Shield helps with Distributed Denial of Service (DDoS) protection, and how Cognito manages user sign-in, authentication, and identity flows for applications.


26.1 Why These Services Matter

By the time a workload is internet-facing, network reachability alone is not the problem.

The real questions become:

  • How do we filter malicious or unwanted requests?
  • How do we reduce exposure to distributed denial-of-service attacks?
  • How do we authenticate end users without building identity infrastructure from scratch?

AWS WAF, AWS Shield, and Amazon Cognito address different parts of that problem space.

  • WAF filters web requests using rule logic.
  • Shield helps protect against distributed denial-of-service, or DDoS, attacks.
  • Cognito manages application user identity, authentication, and token issuance.

These are not interchangeable services. Together they form part of the outer security layer for web applications and APIs.


26.2 AWS WAF Fundamentals

AWS WAF sits in front of supported web entry points and evaluates requests against rules.

Common placements include:

  • CloudFront distributions
  • Application Load Balancers
  • API Gateway APIs

WAF is useful when you need to control request patterns before they reach your application.

Examples:

  • blocking known bad IP ranges
  • filtering obvious exploit patterns such as SQL injection or cross-site scripting attempts
  • rate limiting abusive clients
  • enforcing request size or header expectations for certain paths

WAF is not a magic shield that understands all business logic abuse. It is a request-filtering layer. Its strength comes from applying predictable rules early and consistently.


26.3 Rule Types, Managed Rules, and Tuning

WAF rules can be custom or managed.

Custom rules

These are useful when you know your application behavior and want to encode environment-specific protections.

Examples:

  • block requests missing expected headers
  • limit requests to sensitive paths
  • allow only certain HTTP methods for a route

Managed rules

AWS-managed or partner-managed rule groups provide broader protection for common web attack patterns. They can accelerate a baseline posture, especially for teams that do not want to write every rule from scratch.

But managed rules still need tuning. If you enable a rule group blindly, you may block legitimate requests or create operational confusion. WAF should usually be deployed with a learning period, visibility, and staged enforcement where practical.

Security controls that break good traffic are not mature controls. They are untested assumptions.


26.4 Rate Limiting, Bot Friction, and Edge Filtering

One of WAF's most practical benefits is request-volume control.

Rate-based rules can help absorb simple abuse patterns such as credential stuffing attempts, scraping, or bursty nuisance traffic that would otherwise consume application resources.

This matters because many application attacks are not sophisticated exploits. They are economic attacks on capacity, cost, or user experience.

WAF can also support bot mitigation and geo- or reputation-based filtering depending on your requirements and service placement. The main design principle is to reject bad or suspicious traffic as early as possible so downstream systems spend less time and money handling it.


26.5 AWS Shield Fundamentals

AWS Shield focuses on DDoS protection.

At a high level, DDoS attacks try to exhaust network or application capacity so legitimate users cannot access the system.

AWS provides:

  • Shield Standard, included automatically for many AWS customers and services
  • Shield Advanced, which adds stronger protections, visibility, and response support for higher-risk workloads

Shield is especially relevant for internet-facing services such as CloudFront, Route 53, Global Accelerator, and load-balanced applications.

Architects should understand that DDoS resilience is not delivered by one service alone. It also depends on distribution, scaling, caching, traffic shaping, and the chosen public entry points.


26.6 What Shield Does and Does Not Solve

Shield helps at the network and transport protection layers, but it does not replace application-aware defenses.

That means:

  • Shield can help absorb volumetric attack patterns.
  • WAF helps filter malicious HTTP or HTTPS request patterns.
  • Your application still needs authentication, authorization, rate controls, and efficient request handling.

This layered view matters. Teams sometimes assume that because a service is on AWS, application-level abuse is automatically controlled. That is false. A system can survive a large network flood and still fail under expensive but valid-looking application requests.

Good designs combine distribution services, Shield coverage, WAF rules, and application-level protections rather than expecting one control to do everything.


26.7 Amazon Cognito Fundamentals

Amazon Cognito solves a different problem: user identity for applications.

Cognito is used when applications need to:

  • register users
  • sign users in
  • issue tokens to clients
  • integrate with identity providers
  • manage sessions and user pools without building custom identity services from scratch

Cognito is commonly used for web and mobile applications, especially when the workload needs standards-based authentication flows and token issuance.

It is important to separate Cognito from IAM. IAM manages AWS workforce and workload access to AWS resources. Cognito manages end-user identity for your application.

If you blur those boundaries, the identity model quickly becomes confusing and unsafe.


26.8 Authentication Flows, Federation, and Token Boundaries

Identity design is not only about login screens. It is about trust boundaries.

Architects need to understand:

  • where authentication happens
  • where tokens are issued
  • how applications validate tokens
  • how external identity providers fit into the flow

Cognito can support local user directories and federation with external identity providers. This is useful when applications need to integrate with enterprise identity, social login, or centralized customer identity patterns.

But identity design must stay disciplined:

  • keep token scopes tight
  • define session duration intentionally
  • separate authentication from application authorization logic
  • protect sensitive user flows such as password reset and multi-factor authentication enrollment

Cognito reduces the amount of identity infrastructure you build yourself, but it does not remove the need to reason carefully about authentication and authorization.


26.9 Layered Protection Pattern for Internet-Facing Apps

A common AWS protection pattern looks like this:

  • CloudFront or another edge entry point handles global traffic distribution
  • Shield provides DDoS resilience at the AWS edge and service boundary
  • WAF filters malicious or abusive request patterns
  • Cognito authenticates legitimate users
  • the application enforces authorization, business rules, and service-specific rate control

This layered approach reduces blast radius and clarifies responsibility at each stage.

It also improves cost control. Blocking bad traffic at the edge is usually cheaper than letting it consume application compute, queue capacity, or downstream database resources.


26.10 Common Mistakes

  • assuming WAF alone provides complete application security
  • enabling managed rule groups without tuning and then breaking legitimate traffic
  • relying on Shield while ignoring application-layer abuse patterns
  • confusing Cognito with IAM and mixing end-user identity with AWS administrative access
  • treating authentication as sufficient without designing authorization separately
  • failing to rate-limit high-risk routes such as login, signup, and password-reset paths
  • placing security controls only near the application instead of filtering suspicious traffic earlier
  • ignoring observability for blocked requests, authentication failures, and attack patterns

26.11 Hands-On Tasks

  1. List three request patterns that should be considered for WAF rules on a public API.
  2. Explain the difference between a DDoS protection problem and an application abuse problem.
  3. Describe when Shield Advanced may be justified compared with relying only on baseline AWS protections.
  4. Sketch an authentication flow for a web application that uses Cognito and tokens.
  5. Explain why login success does not remove the need for application-level authorization checks.

26.12 Recap

WAF filters web requests, Shield strengthens DDoS resilience, and Cognito manages end-user identity. Together they protect different layers of an internet-facing AWS application. Strong architectures treat them as complementary controls within a broader security design that also includes authorization, monitoring, scaling, and safe operational practices.

Next: 27: Backup and Disaster Recovery

27: Backup and Disaster Recovery

Backups and disaster recovery are related, but they are not the same thing. A backup helps you restore data, while a disaster recovery plan helps you restore service after a major failure such as infrastructure loss, corruption, or regional disruption.

This chapter explains how to think about recovery in business terms instead of vague promises. You will learn why Recovery Point Objective (RPO) and Recovery Time Objective (RTO) guide design choices, and how AWS supports recovery patterns with different costs, speeds, and levels of complexity.


27.1 Why Backup and Disaster Recovery Matter

Failures are not theoretical.

Data can be deleted, encrypted by ransomware, overwritten by deployment mistakes, corrupted by application bugs, or lost through infrastructure failure. Entire regions are designed to be highly resilient, but serious regional disruptions and dependency failures still have to be planned for.

Backup and disaster recovery, often shortened to DR, exist to answer two hard questions:

  • How much data can we afford to lose?
  • How long can the service be unavailable?

If those questions are not answered explicitly, recovery design becomes guesswork.

Production teams often discover too late that they had backups but no realistic restore process, or that they had high availability in one region but no regional recovery plan at all.


27.2 Backups Versus High Availability Versus Disaster Recovery

These terms are related but not identical.

Backup

A backup is a recoverable copy of data captured for restoration later.

High availability

High availability keeps a service running through localized failure, usually within one region or across multiple Availability Zones.

Disaster recovery

Disaster recovery restores service after a major failure that exceeds normal high-availability assumptions, such as regional disruption, destructive account compromise, or unrecoverable application or data damage.

This distinction matters because Multi-AZ alone is not a backup strategy, and backups alone do not provide fast recovery.

Architects must design across all three layers, not assume one of them covers the rest.


27.3 RPO and RTO

Two metrics drive most recovery design.

Recovery Point Objective, or RPO

RPO defines how much data loss is acceptable.

If the RPO is 15 minutes, the business accepts losing up to 15 minutes of recent data in a disaster scenario.

Recovery Time Objective, or RTO

RTO defines how long it can take to restore service.

If the RTO is 1 hour, the recovery plan must restore the service within that time window.

These values are not infrastructure trivia. They directly affect architecture, cost, and operational complexity.

  • Lower RPO usually requires stronger replication or more frequent backups.
  • Lower RTO usually requires pre-provisioned capacity and rehearsed failover.

When teams say they need near-zero loss and near-instant recovery, they are usually asking for one of the most expensive and complex recovery postures available.


27.4 AWS Backup Building Blocks

AWS provides multiple ways to protect data, including service-native backups and centralized backup management.

Important building blocks include:

  • automated snapshots and backups for services such as RDS and EBS
  • versioning and lifecycle controls for S3
  • retention policies aligned to business and compliance needs
  • cross-account or cross-region backup copy patterns for stronger isolation
  • centralized backup policy management where appropriate

The design choice is not only about whether a service can create backups. It is about whether those backups are retained correctly, isolated sufficiently, and restorable under pressure.

Backup isolation is especially important. If an attacker compromises the same account and can delete backups, recovery confidence is weaker than it appears.


27.5 Restore Testing Is Part of the Backup Strategy

A backup that has never been restored is only an assumption.

Restore testing should verify:

  • the backup exists where expected
  • the restore process is documented and works
  • dependencies such as KMS keys, networking, IAM, and DNS are understood
  • restored data is usable by the application
  • the team can complete the process inside the expected RTO

This is one of the most common maturity gaps in cloud environments. Teams pay for backups for years without proving that the restore path actually works.

Recovery design must be tested as an operational process, not only configured as a checkbox.


27.6 Disaster Recovery Patterns

AWS recovery patterns usually fall into four broad levels.

Backup and restore

This is the lowest-cost pattern. Data and configuration backups exist, but infrastructure is rebuilt after the failure. Recovery time is usually slower.

Pilot light

Critical data and minimal core services exist in the recovery region, but most application capacity is scaled up only during failover.

Warm standby

A reduced-capacity version of the workload already runs in the recovery region. Failover is faster, but cost is higher.

Active-active or multi-site

Traffic and services run in more than one region at the same time. This provides the strongest posture for low RTO and low RPO, but it is also the most complex to design, test, and operate.

The architect's job is to match the pattern to business impact rather than chase the most advanced-sounding design.


27.7 Regional, Account, and Security Failure Scenarios

Good recovery planning considers more than hardware failure.

Important scenarios include:

  • accidental deletion by an operator or pipeline
  • application bugs that corrupt data logically
  • ransomware or destructive credential compromise
  • region-wide service disruption
  • account compromise or misconfiguration that affects production resources and backups

These scenarios matter because the recovery design that handles one failure may not handle another.

For example:

  • Multi-AZ protects against localized infrastructure failure but not malicious deletion.
  • Same-account backups may not be sufficient for account compromise.
  • Cross-region replication may replicate corruption as quickly as healthy data if no recovery checkpoint strategy exists.

Recovery architecture must be threat-aware, not only availability-aware.


27.8 Data Consistency and Application Dependencies

Restoring a system is often harder than restoring one database.

Applications usually depend on combinations of:

  • databases
  • object storage
  • queues or streams
  • secrets and configuration
  • DNS and certificate configuration
  • IAM roles and network controls

If those dependencies are not coordinated, the recovered system may come up in a broken or inconsistent state.

That is why disaster recovery planning often needs dependency maps and recovery order decisions. A restored application that points to the wrong queue, lacks the right secret, or depends on a stale DNS record is not truly recovered.


27.9 Solutions Architect Review Checklist

During design review, ask:

  • What are the business RPO and RTO requirements for this workload?
  • Which failure scenarios are in scope: AZ, region, data corruption, credential compromise, or all of them?
  • Where are backups stored, and can attackers in the primary account destroy them?
  • How often are restores tested?
  • Which services or configuration dependencies must be recovered together?
  • Does the planned recovery pattern match the actual cost tolerance and downtime tolerance of the business?

This review usually reveals whether recovery design is real or only aspirational.


27.10 Common Mistakes

  • assuming Multi-AZ availability is the same as a backup strategy
  • creating backups without ever testing restores
  • defining RPO and RTO implicitly instead of agreeing on them with the business
  • storing backups in ways that are vulnerable to the same account compromise or deletion path as production
  • planning cross-region recovery without coordinating DNS, secrets, and application dependencies
  • using replication alone as if it were protection against logical corruption or ransomware
  • documenting DR steps once and never updating them after architecture changes
  • choosing an advanced DR pattern whose cost and operational burden the team cannot sustain

27.11 Hands-On Tasks

  1. Define RPO and RTO for a low-traffic internal reporting tool and for a revenue-generating production API.
  2. Compare backup and restore, pilot light, warm standby, and active-active for one workload you know.
  3. List the dependencies that would need to be recovered together for a three-tier web application.
  4. Describe how you would test a restore for a database-backed service without waiting for a real outage.
  5. Explain why same-account backups may be insufficient for certain threat models.

27.12 Recap

Backups, high availability, and disaster recovery serve different purposes and must be designed together. RPO and RTO define the acceptable loss and recovery window, and those targets determine which recovery pattern makes sense. In AWS, strong recovery design includes protected backups, restore testing, dependency-aware procedures, and clear trade-offs between speed, complexity, and cost.

Next: 28: Cost Optimization and Well-Architected Review

28: Cost Optimization and Well-Architected Review

Good AWS design is not only about making systems work. It is also about spending money deliberately and checking whether the architecture is balanced across cost, security, reliability, performance, and operations.

This chapter explains how cost optimization works as an ongoing engineering habit, not a one-time cleanup. You will learn how the AWS Well-Architected Framework helps teams review trade-offs, find waste, and make better design choices before small inefficiencies become expensive problems.


28.1 Why Cost Optimization Needs Design Discipline

Cloud cost problems rarely come from one expensive instance.

They usually come from many small decisions:

  • resources left running without purpose
  • overprovisioned environments
  • unnecessary data transfer
  • poor storage lifecycle choices
  • architecture patterns that scale cost faster than value

Cost optimization is not about making AWS cheap at all costs. It is about spending deliberately.

The best question is not, "How do we reduce the bill?" The better question is, "Are we paying for the right things at the right level for the business need?"

That framing matters because some higher costs are justified by improved resilience, lower operational risk, or better customer experience. Cost optimization is a trade-off exercise, not blind minimization.


28.2 Major AWS Cost Drivers

Most AWS bills are shaped by a few predictable categories:

  • compute runtime and instance sizing
  • storage capacity and access patterns
  • data transfer
  • managed service consumption models
  • logging, monitoring, and analytics volume
  • provisioned capacity left idle

Architects need to understand not only the direct price of a service, but also the supporting cost pattern around it.

Examples:

  • a cheap compute tier may become expensive once cross-AZ or cross-region data transfer is included
  • verbose logs retained indefinitely may create unnecessary observability cost
  • a serverless workload can be efficient at low volume but surprising at extreme request rates or with inefficient code paths

Cost optimization starts with understanding the shape of the workload, not with memorizing a pricing page.


28.3 Common Waste Patterns

Waste in AWS is usually operational, not theoretical.

Typical examples include:

  • development resources left running after work hours
  • oversized EC2 instances chosen without load evidence
  • unattached EBS volumes and old snapshots
  • idle load balancers, NAT gateways, or IP allocations
  • duplicated data copies with no lifecycle strategy
  • high-cost services used for low-value internal workloads

Another common waste pattern is architectural mismatch. Teams sometimes choose a service because it is familiar or because it sounds advanced, not because it fits the access pattern.

For example, running a constantly idle fleet to serve infrequent jobs may cost far more than an event-driven design.


28.4 Right-Sizing and Elasticity

One of cloud's main promises is elasticity, but many workloads still run as if capacity were fixed.

Right-sizing means matching resource size and count to actual demand.

Important practices include:

  • reviewing utilization trends instead of provisioning by guesswork
  • scaling out or in based on meaningful load signals
  • selecting instance families that fit the workload profile
  • turning off nonproduction resources when they are not needed

Right-sizing is not a one-time project. Workloads change. Usage changes. Release patterns change. Periodic review is necessary.

Architects should also remember that underprovisioning has a cost too. Performance failures, operator time, and customer dissatisfaction are real business costs.


28.5 Storage, Retention, and Data Transfer Economics

Storage cost is often underestimated because the monthly growth appears gradual.

Design choices that matter include:

  • whether objects need high-frequency access or can move to cheaper tiers
  • whether snapshots and backups have retention and cleanup rules
  • whether logs are kept indefinitely without operational reason
  • whether traffic patterns create unnecessary cross-AZ, cross-region, or internet egress charges

Data transfer deserves special attention. A design that looks simple on a diagram can become expensive if services exchange large amounts of data across boundaries that incur transfer charges.

That is why cost review is part of architecture review, not only part of finance reporting.


28.6 Purchasing Models and Commitment Decisions

AWS offers different purchasing models for some services, especially compute.

The main lesson is not to memorize every option. The lesson is to match commitment level to workload predictability.

  • steady, predictable baseline usage may justify longer commitments
  • variable or experimental workloads may need more flexibility
  • interruptible or fault-tolerant jobs may fit lower-cost models designed for noncritical execution patterns

Commitment can reduce cost significantly, but only when the workload pattern is understood. Premature commitment based on assumptions can lock in the wrong economics.


28.7 The Well-Architected Framework as a Review Tool

The AWS Well-Architected Framework gives teams a structured way to review design decisions across key pillars:

  • operational excellence
  • security
  • reliability
  • performance efficiency
  • cost optimization
  • sustainability

This framework is useful because cost decisions should not be made in isolation.

For example:

  • removing redundancy may lower cost but damage reliability
  • reducing observability spend may save money but slow incident response
  • aggressive caching may improve performance and cost, but only if data freshness requirements permit it

Well-Architected reviews force teams to make those trade-offs explicit.


28.8 How to Run a Practical Review

A useful review is evidence-based, not slogan-based.

Ask questions such as:

  • Which components drive the largest percentage of monthly spend?
  • Are we paying for idle capacity?
  • Which reliability controls are intentional, and which are accidental overengineering?
  • Are monitoring, backups, and security controls sized to real need?
  • Does this workload need this level of regional redundancy, or is a simpler posture acceptable?
  • Which costs would rise fastest if traffic doubled?

The goal is not to chase perfection. The goal is to identify the next set of changes that materially improves architecture quality.

Well-Architected work is most valuable when it becomes a repeatable review habit, especially before major launches or after cost surprises.


28.9 Cost Optimization Guardrails and Ownership

Strong cost control requires ownership.

Useful guardrails include:

  • tagging standards so spend can be attributed to teams and environments
  • budgets and alerts for unexpected growth
  • scheduled cleanup or shutdown for nonproduction resources
  • regular review of unused or orphaned resources
  • clear approval patterns for expensive architecture changes

Without ownership, cost optimization turns into periodic cleanup campaigns rather than a stable operating model.

This is why cost and architecture should be discussed together. Teams that own the design should also understand the financial shape of their design choices.


28.10 Common Mistakes

  • treating cost optimization as a finance-only problem instead of an architecture and operations problem
  • minimizing cost without considering reliability, performance, or security consequences
  • overprovisioning resources because no one reviewed actual utilization
  • ignoring data transfer and retention costs while focusing only on instance pricing
  • committing to long-term purchasing models before workload behavior is understood
  • keeping old snapshots, logs, and resources indefinitely because cleanup ownership is unclear
  • running Well-Architected reviews as checklist exercises without evidence or follow-through
  • assuming the current bill shape will remain stable as the workload scales

28.11 Hands-On Tasks

  1. Pick one AWS workload and identify its likely top three cost drivers.
  2. List five waste patterns you would check first in a nonproduction account.
  3. Explain one case where paying more is the correct architectural decision.
  4. Define a simple tagging model that would let a team separate production, staging, and shared-platform spend.
  5. Write down three Well-Architected review questions you would ask before approving a major workload expansion.

28.12 Recap

Cost optimization in AWS is a design discipline grounded in usage patterns, not a late-stage cleanup activity. The best results come from understanding cost drivers, removing waste deliberately, matching service and purchasing choices to real workload behavior, and reviewing trade-offs through the Well-Architected pillars. A mature workload is not the cheapest possible system. It is the system whose cost and architectural quality both make sense for the business.

Next: 29: Multi-Account and Landing Zone Design

29: Multi-Account and Landing Zone Design

As AWS environments grow, one account is usually not enough. Multi-account design gives teams clearer security boundaries, better billing separation, safer experimentation, and more controlled operations across environments and business units.

This chapter explains how a landing zone provides the starting structure for operating at scale. You will learn how AWS Organizations, service control policies (SCPs), shared logging, and account standards are used to build a foundation that supports governance without blocking delivery.


29.1 Why Multi-Account Design Matters

One AWS account is enough for learning, but it is rarely enough for a mature organization.

As environments grow, a single account creates problems:

  • weak blast-radius boundaries
  • unclear ownership between teams and environments
  • noisy billing and logging separation
  • broad permissions that are hard to govern safely
  • operational coupling between unrelated workloads

Multi-account design exists to contain risk and improve clarity.

It lets organizations separate workloads by environment, business unit, security boundary, or operational purpose. That separation makes it easier to apply different controls to production, sandbox, logging, networking, and shared-platform services.

The key idea is simple: accounts are not only billing containers. In AWS, they are one of the strongest native isolation boundaries.


29.2 AWS Organizations Fundamentals

AWS Organizations is the main service used to manage multiple AWS accounts together.

It allows teams to:

  • create and group accounts centrally
  • apply policies across those accounts
  • consolidate billing
  • structure environments under a common governance model

Organizations introduces hierarchy through organizational units, usually shortened to OUs. OUs help group accounts by purpose.

Examples:

  • sandbox OU
  • production OU
  • security OU
  • infrastructure OU

This hierarchy matters because governance should reflect workload sensitivity. A production account should not be controlled the same way as an experimental sandbox account.


29.3 Service Control Policies and Guardrails

Service control policies, or SCPs, are one of the most important governance tools in a multi-account AWS environment.

SCPs do not grant permissions. They define the maximum allowed permissions for accounts in an organization or OU.

That means SCPs are best used as guardrails.

Examples:

  • prevent disabling CloudTrail or security tooling
  • restrict use of certain regions
  • deny creation of specific high-risk resources outside approved workflows
  • block use of the root user for normal operations where applicable

SCPs are powerful, but they must be designed carefully. Overly broad denies can break legitimate operational work and create hard-to-debug failures.

The design goal is to enforce clear organizational boundaries, not to create a maze of opaque policy side effects.


29.4 Common Account Patterns

There is no single perfect account layout, but several patterns appear repeatedly.

Common account roles include:

  • sandbox or development accounts for experimentation
  • staging or preproduction accounts for release validation
  • dedicated production accounts for live workloads
  • shared services accounts for tooling, CI/CD, or internal platforms
  • log archive or security accounts for centralized audit and detection systems
  • networking accounts for shared connectivity in larger organizations

The deeper reason for these patterns is separation of concern.

For example, if security logs are stored in the same account as the workload that generated them, a compromise of that workload account may also endanger the audit data. Moving log archival and some security tooling into separate accounts improves resilience and accountability.


29.5 What a Landing Zone Provides

A landing zone is the baseline multi-account environment design an organization uses to start safely and consistently.

It usually includes:

  • an account structure
  • identity and access patterns
  • logging and audit configuration
  • network and connectivity foundations
  • guardrails and policy baselines
  • provisioning automation for new accounts

A landing zone is valuable because unmanaged growth creates drift quickly. If every team creates accounts with different logging, tagging, identity, and network decisions, governance becomes expensive and fragile.

The landing zone is not the final architecture of every workload. It is the foundation that makes later workload-specific architecture safer and more repeatable.


29.6 Identity, Access, and Administrative Model

Multi-account design works best when workforce access is centralized and role-based.

Good practice usually includes:

  • centralized identity integration for human users
  • role assumption into target accounts instead of long-lived account-local user sprawl
  • separate administrative, read-only, and emergency-access paths
  • deliberate access boundaries between production and nonproduction environments

This matters because account sprawl without identity discipline becomes a security problem quickly.

Architects should favor a model where users authenticate through a centralized identity layer and assume roles into the accounts they need. That improves auditability and reduces unmanaged credentials.


29.7 Shared Services, Logging, and Network Design

As organizations grow, some capabilities are more effective when centralized.

Examples include:

  • centralized CloudTrail and Config aggregation
  • security tooling and detections
  • CI/CD services used across many application accounts
  • DNS, connectivity, or transit architecture in larger network topologies

Centralization can improve consistency, but it also creates dependencies. A shared services account becomes part of the operational backbone, so its resilience, access model, and change controls need more attention than a normal application account.

Landing zone design is therefore a balance between standardization and avoiding oversized shared bottlenecks.


29.8 Provisioning, Governance, and Lifecycle Management

The real test of a landing zone is what happens when new accounts are needed.

Mature environments do not create accounts manually and then fix them later. They provision them with a baseline that includes:

  • required logging
  • approved identity integration
  • default guardrails
  • naming and tagging standards
  • baseline network and security controls

Lifecycle management matters too. Accounts should have owners, intended purpose, contact paths, and retirement rules. Orphaned accounts are a governance and cost problem.

This is why landing zones are not only technical templates. They are operating models.


29.9 Solutions Architect Review Questions

When evaluating a multi-account design, ask:

  • What isolation problem are accounts solving here: security, environment separation, billing clarity, or all of them?
  • Which controls belong at the organization level and which belong in workload accounts?
  • Are SCPs enforcing a few clear guardrails or compensating for weak identity and deployment practices?
  • Where are audit logs, security findings, and shared automation hosted?
  • How are new accounts created and brought under governance quickly?
  • Does the shared-platform design help teams move faster, or has it created central bottlenecks?

These questions usually expose whether the environment is intentionally governed or simply large.


29.10 Common Mistakes

  • keeping everything in one account long after the organization has outgrown that model
  • creating many accounts without a landing-zone baseline for logging, identity, and guardrails
  • using SCPs as a substitute for least-privilege IAM and sound operational design
  • centralizing too many services and creating fragile shared bottlenecks
  • allowing workforce users to exist separately in many accounts instead of using centralized access patterns
  • failing to separate production and nonproduction blast radius clearly
  • creating accounts without ownership, lifecycle tracking, or purpose-based naming
  • assuming consolidated billing alone is the same as governance

29.11 Hands-On Tasks

  1. Sketch an AWS Organizations OU structure for sandbox, staging, production, security, and shared services.
  2. Define three SCP guardrails that would be reasonable for production accounts.
  3. Explain why a centralized log archive account can improve security investigations.
  4. Describe a role-based access pattern for engineers who need read-only production access and admin access only in sandbox.
  5. List the baseline controls you would want every new AWS account to inherit automatically.

29.12 Recap

Multi-account AWS design uses the account boundary as a core isolation and governance tool. AWS Organizations, OUs, and SCPs make it possible to apply guardrails across environments, while a landing zone provides the baseline structure for identity, logging, networking, and account provisioning. Strong designs use these capabilities to reduce blast radius, clarify ownership, and keep growth manageable over time.

Next: 30: Multi-Region Architecture

30: Multi-Region Architecture

Most AWS workloads start in one Region, but some need to run across multiple Regions for resilience, lower latency, or legal and compliance reasons. Multi-region design can improve outcomes, but it also adds real complexity to networking, data management, deployment, and operations.

This chapter explains when multi-region architecture is worth that cost. You will learn how teams think about traffic routing, failover, data replication, and service placement when building systems that must keep working beyond the limits of a single Region.


30.1 Why Multi-Region Architecture Matters

Most AWS workloads start in one region, and many should stay that way.

Single-region design is simpler, cheaper, and easier to operate. But some workloads need more:

  • lower latency for globally distributed users
  • resilience against regional disruption
  • geographic data placement for legal or compliance reasons
  • controlled workload distribution across large geographies

Multi-region architecture is therefore a business-driven choice, not a maturity badge.

The first question should never be, "Can we run in multiple regions?" The first question should be, "What specific problem justifies the extra complexity?"


30.2 Regional Independence as the Core Principle

Regions are designed to be isolated failure domains.

That isolation is useful only if your workload design respects it.

Regional independence means:

  • each region has enough local capacity and configuration to operate as intended
  • a regional problem does not immediately cascade through shared dependencies
  • failover does not depend on manual heroics or hard-coded assumptions

This is harder than duplicating compute. Identity, data, secrets, DNS, deployment pipelines, observability, and operational runbooks all need regional thinking.

If two regions share too many hidden dependencies, the design may look multi-region on a diagram while still failing like a single-region system.


30.3 Traffic Routing Patterns

Traffic routing is one of the first visible design choices in multi-region systems.

Common patterns include:

  • active-passive, where one region handles traffic and another waits for failover
  • active-active, where more than one region serves users concurrently
  • geo- or latency-based routing, where users are directed based on location or response time

Route 53, CloudFront, and other edge services can participate in these patterns, but the routing layer should reflect the recovery and consistency model.

For example, active-active routing sounds attractive, but it is only useful if the application and data layers can truly support concurrent multi-region behavior.


30.4 Data Replication and Consistency Trade-Offs

Data is usually the hardest part of multi-region architecture.

Questions include:

  • Is data replicated asynchronously or synchronously?
  • Can users read and write in more than one region?
  • What level of inconsistency is acceptable during failover?
  • Does the workload prioritize availability or strict write ordering?

Cross-region replication improves resilience, but it introduces latency, consistency, and operational complexity.

In many architectures, active-passive data models are easier to reason about than full multi-writer systems. Multi-writer systems can be powerful, but they require careful conflict handling, idempotency, and application semantics.

The architect's job is to match the replication model to the business requirement rather than overengineering for theoretical perfection.


30.5 Stateless and Stateful Components

Multi-region design is usually easiest for stateless layers and hardest for stateful ones.

Stateless components include:

  • web or API compute layers
  • edge caching and content distribution
  • event consumers that can be restarted or replayed safely

Stateful components include:

  • databases
  • session stores
  • queues and streams with ordering requirements
  • file stores with strong consistency expectations

This distinction matters because many diagrams show duplicated application servers but ignore the harder recovery path for the data and state they depend on.

A multi-region application is only as strong as its state model.


30.6 DNS, Health Checks, and Failover Behavior

Failover depends on detection and routing.

Important design questions include:

  • How is regional health determined?
  • What metrics or checks trigger failover?
  • How quickly should traffic move?
  • What happens to in-flight sessions or partially completed transactions?

Route 53 health checks and routing policies can help, but DNS failover alone is not enough if the recovery region is missing warm data, dependencies, or secrets.

Failover should also be rehearsed. The first time a team watches a regional failover should not be during a production incident.


30.7 Security, Identity, and Regional Dependencies

Security design must be region-aware too.

Architects should review:

  • whether secrets and key access work in every required region
  • whether audit trails and monitoring remain visible during regional issues
  • whether IAM and identity dependencies introduce hidden coupling
  • whether recovery automation has the permissions it needs in the target region

The same question applies to compliance. If data must remain in a given geography, a multi-region design may need region selection rules and data-separation controls rather than universal replication.

Multi-region architecture is not only a resilience pattern. It can also be a data-governance pattern.


30.8 Cost and Operational Complexity

Multi-region systems cost more.

That cost appears in several ways:

  • duplicate or standby infrastructure
  • cross-region data transfer
  • replication overhead
  • more complex pipelines and observability
  • more demanding operational rehearsals and documentation

There is also an engineering complexity cost. Testing, deployments, incident response, and debugging all become harder when multiple regions can serve traffic or take over service.

This is why architects should resist the idea that multi-region is always the most advanced or correct answer. Sometimes a strong single-region, multi-AZ design plus good backups and a realistic DR plan is the better trade-off.


30.9 Solutions Architect Decision Framework

Ask these questions before committing to multi-region:

  • Is the driver resilience, latency, compliance, or all three?
  • What RTO and RPO actually justify the design?
  • Does the workload need active-active behavior, or is active-passive sufficient?
  • Which components are stateless and easy to duplicate, and which are stateful and difficult to coordinate?
  • Can the team test, observe, and operate this design consistently?
  • Would a simpler single-region design with strong recovery controls meet the same business need?

These questions often prevent teams from building an expensive pattern they cannot operate well.


30.10 Common Mistakes

  • choosing multi-region for prestige rather than for a specific business requirement
  • duplicating compute while ignoring the harder data-consistency problem
  • assuming DNS failover alone creates a usable recovery posture
  • sharing too many hidden dependencies across regions and weakening true independence
  • underestimating the cost of replication, data transfer, and operational complexity
  • designing active-active routing without clear conflict-handling or consistency rules
  • failing to rehearse failover and failback procedures
  • ignoring regulatory constraints on where data may be stored or processed

30.11 Hands-On Tasks

  1. Compare active-passive and active-active multi-region design for a customer-facing web application.
  2. List the stateful components that would make multi-region harder for one workload you know.
  3. Explain how Route 53 could participate in a regional failover pattern and what it cannot solve by itself.
  4. Define one business case where multi-region is justified and one where it is not.
  5. Describe how you would test a regional failover without waiting for a real outage.

30.12 Recap

Multi-region architecture should be driven by explicit needs such as resilience, latency, or compliance. It requires more than copying infrastructure into another region: traffic routing, state management, failover behavior, security dependencies, and operating processes all have to work across regions. The best design is the one whose extra complexity is justified by real business impact.

Next: 31: Data and Analytics Services

31: Data and Analytics Services

AWS offers a wide range of data and analytics services, each built for a different job. Services such as Amazon Athena, AWS Glue, Amazon Redshift, and Amazon Kinesis help teams query data, prepare datasets, run large-scale analytics, and process streams of events.

This chapter explains how these services fit together at a high level instead of treating them as isolated tools. You will learn how to think about batch versus streaming, data lake versus warehouse patterns, and how latency, scale, and operational effort influence the right choice.


31.1 Why Analytics Architecture Matters

Operational systems answer immediate application needs. Analytics systems answer broader business questions.

Organizations eventually want to know:

  • what users are doing over time
  • how revenue, traffic, or error patterns are changing
  • how to combine data from multiple systems
  • how to analyze streams of events rather than only current transaction state

Analytics architecture matters because those questions usually require different storage, processing, and query patterns than online transaction systems.

If teams force analytical workloads directly onto primary application databases, they often create contention, poor performance, and fragile reporting pipelines.


31.2 The Main Analytics Workload Types

AWS data and analytics services are easier to understand when grouped by workload type.

Common categories include:

  • interactive querying of data already stored in files or objects
  • ETL or ELT processing to transform and prepare datasets
  • warehouse-style analytics across curated, structured data
  • streaming ingestion and near-real-time processing

These categories overlap, but the design question is always similar: what is the shape of the data, how quickly must insights be available, and who needs to query it?

Once that is clear, the service choices become easier to reason about.


31.3 Athena for Querying Data in S3

Amazon Athena is commonly used to run SQL queries directly against data stored in Amazon S3.

Athena is attractive when:

  • you already have data landing in S3
  • the workload is analytical rather than transactional
  • you want serverless querying without managing database servers
  • query frequency is moderate or highly variable

Athena works best when the underlying data is organized well. File format, partitioning, schema management, and dataset layout strongly affect both performance and cost.

That means Athena is simple to start with, but good results still require data discipline. Dumping raw files into S3 without structure often leads to slow and expensive queries.


31.4 Glue for Metadata and Data Preparation

AWS Glue is commonly used for data cataloging, schema discovery, and data transformation workflows.

It helps teams:

  • maintain a metadata catalog for datasets
  • discover schema from data sources
  • transform data into more useful analytical forms
  • orchestrate preparation workflows

Glue is important because analytics systems depend on more than storage. Analysts and downstream tools need to understand what a dataset means, how it is structured, and whether it is ready for use.

In many architectures, Glue becomes the bridge between raw data landing zones and curated analytical datasets.


31.5 Redshift for Warehouse-Style Analytics

Amazon Redshift is designed for warehouse-style analytics over large structured datasets.

It is often a better fit than ad hoc querying when:

  • many users run repeated analytical queries
  • performance expectations are stricter
  • data is curated into a model designed for business analysis
  • teams need more warehouse-like behavior and tuning control

Redshift is not simply "bigger Athena" and Athena is not simply "serverless Redshift." They fit different operating models.

Athena is often strong for flexible querying over data in S3. Redshift is stronger when a managed warehouse with curated analytical structures and predictable performance is justified.


31.6 Kinesis and Streaming Data Patterns

Not all analytics begins with static files.

Streaming systems are used when events must be collected and processed continuously, such as:

  • clickstream or telemetry events
  • application logs and metrics pipelines
  • IoT device events
  • operational event processing for alerts or dashboards

Amazon Kinesis supports streaming ingestion and downstream processing patterns for workloads that need near-real-time data flow.

Streaming architecture introduces different design concerns:

  • ordering and partitioning
  • consumer lag
  • replay and retention
  • downstream scaling
  • cost tied to sustained event volume

Streaming is powerful, but it should be chosen because the latency requirement is real, not because batch processing sounds less modern.


31.7 Data Lake Versus Warehouse Thinking

Many AWS analytics environments use both data lake and warehouse patterns.

At a high level:

  • a data lake stores raw and transformed datasets, often in S3
  • a warehouse stores curated analytical data optimized for business queries

The lake can be flexible and broad. The warehouse is usually more modeled and intentional.

This distinction helps avoid confusion. If every dataset is treated as fully curated from day one, ingestion slows down. If everything remains raw forever, analytical usability suffers.

Mature systems usually separate raw, processed, and curated layers.


31.8 Choosing the Right Analytical Path

Architects should ask:

  • Is the data queried occasionally or constantly?
  • Is the need ad hoc exploration or structured repeated reporting?
  • Does the business need near-real-time reaction, or is batch acceptable?
  • How clean and structured is the source data?
  • Who will use the data: engineers, analysts, dashboards, or machine-driven workflows?

Example decision patterns:

  • S3 plus Athena fits flexible, serverless analytics on well-organized files.
  • Glue supports schema management and transformation for datasets moving through analytical stages.
  • Redshift fits repeated warehouse-style analytical workloads with stronger performance expectations.
  • Kinesis fits event-driven streaming ingestion where latency matters.

The best architecture often combines these rather than choosing one service for every analytical job.


31.9 Governance, Security, and Cost Considerations

Analytics environments introduce their own governance issues.

Important concerns include:

  • controlling access to sensitive datasets
  • knowing which data can move into broader analytical stores
  • managing schema quality and data ownership
  • optimizing storage format and query patterns to avoid waste
  • tracking who can access curated business data and raw event data

Analytics can also become a major cost center if datasets are duplicated carelessly, poorly partitioned, or queried inefficiently.

Architects should treat analytics as a platform design problem, not only as a collection of tools.


31.10 Common Mistakes

  • querying primary application databases directly for heavy analytical workloads
  • storing data in S3 without partitioning, metadata discipline, or lifecycle thinking
  • using streaming systems when batch processing would have been sufficient
  • treating Athena, Glue, Redshift, and Kinesis as interchangeable
  • building a warehouse without clear ownership of data modeling and quality
  • ignoring access control and sensitivity classification for analytical datasets
  • duplicating large datasets without understanding the cost impact
  • assuming analytics architecture is only a data-team concern instead of a broader platform concern

31.11 Hands-On Tasks

  1. Compare an S3 plus Athena design with a Redshift design for a weekly executive reporting workload.
  2. Explain where Glue fits between raw data ingestion and analyst-ready datasets.
  3. Define one use case where Kinesis is justified and one where a scheduled batch process is sufficient.
  4. Sketch raw, processed, and curated data layers for an e-commerce analytics platform.
  5. List the governance questions you would ask before giving analysts access to customer event data.

31.12 Recap

AWS analytics services support different data shapes and latency requirements. Athena is useful for querying well-structured data in S3, Glue helps catalog and prepare data, Redshift supports warehouse-style analytics, and Kinesis handles streaming event flows. Strong analytical architecture chooses among these tools based on workload patterns, data quality needs, governance requirements, and cost discipline.

Next: 32: Capstone Project

32: Capstone Project

This chapter brings the roadmap together by moving from individual AWS services to a complete system design. The goal is not to memorize one perfect architecture, but to practice making connected decisions that reflect real production needs.

You will use the ideas from earlier chapters to shape a realistic workload across networking, compute, storage, security, observability, delivery, and cost. The focus is on reasoning clearly about trade-offs, because strong AWS design comes from how services work together, not from listing as many services as possible.


32.1 Why a Capstone Matters

Learning services one by one is necessary, but real systems are built from service combinations and trade-offs.

The capstone matters because architecture skill is not proven by knowing what Lambda or Route 53 does in isolation. It is proven by being able to choose a coherent design, explain the boundaries between services, and justify why the design is appropriate for the workload.

This chapter is therefore not a detailed build script. It is a synthesis chapter that forces design thinking across the roadmap.


32.2 Define the Target Workload

Use a workload realistic enough to exercise the roadmap.

One strong example is a small but production-aware digital commerce or booking platform with these needs:

  • public web or mobile client access
  • a secure API layer
  • application compute that can scale
  • persistent data storage
  • asynchronous processing for notifications or background jobs
  • monitoring, auditability, backups, and deployment automation

You could also choose a SaaS internal platform or event-driven order-processing system. The exact domain matters less than whether the system forces you to make meaningful architecture decisions.

The best capstone is one that is simple enough to finish conceptually but rich enough to expose trade-offs.


32.3 Reference Architecture for the Capstone

A reasonable capstone architecture might include:

  • Route 53 for DNS
  • CloudFront for edge delivery of static content
  • WAF and Shield protection for internet-facing entry points
  • Cognito for user authentication
  • API Gateway or an Application Load Balancer as the front door to application logic
  • Lambda, ECS on Fargate, or EC2-based services depending on the chosen compute model
  • S3 for static assets and document storage
  • RDS, DynamoDB, or both depending on the data access pattern
  • SQS or EventBridge for asynchronous workflows
  • CloudWatch for metrics, logs, alarms, and dashboards
  • CloudTrail and Config for audit and governance
  • KMS, Secrets Manager, and Parameter Store for encryption and secret or config handling
  • Infrastructure as code and CI/CD for repeatable delivery

This is not the only valid architecture. It is a reference shape that covers the main learning surfaces from the roadmap.


32.4 Choose Compute and Data Intentionally

The capstone becomes meaningful when you justify your core choices.

Examples:

  • Choose Lambda if the workload is highly event-driven, bursty, and operational simplicity matters more than low-level runtime control.
  • Choose ECS on Fargate if you want container packaging without managing EC2 hosts.
  • Choose EC2 if you specifically need instance-level control and understand the added operational cost.

For data:

  • choose RDS or Aurora when relational integrity and SQL access matter
  • choose DynamoDB when access patterns are known and horizontal scale with low operational overhead matters
  • choose S3 for static content, durable object storage, or analytical export landing zones

There is no prize for using the most services. The capstone is strongest when the chosen components clearly match the workload.


32.5 Security and Identity Baseline

Every capstone design should define a security baseline, not treat security as an appendix.

The baseline should include:

  • least-privilege IAM roles for workloads and operators
  • Cognito or another appropriate identity boundary for end users
  • WAF rules and Shield coverage for public entry points
  • KMS-backed encryption for sensitive data stores where appropriate
  • Secrets Manager or Parameter Store for secret and configuration retrieval
  • CloudTrail and Config for auditability and change tracking

Security design should also describe the trust boundaries between clients, edge services, application components, and data stores.

If you cannot explain those trust boundaries, the capstone is incomplete.


32.6 Reliability, Scaling, and Recovery Design

A production-aware capstone should specify:

  • whether the workload runs across multiple Availability Zones
  • how it scales with demand
  • what happens when a component fails
  • how backups are handled
  • what the approximate RPO and RTO expectations are

Examples:

  • use Multi-AZ patterns for core infrastructure inside one region
  • place asynchronous workloads behind queues to absorb spikes
  • define whether the disaster recovery posture is backup-and-restore, pilot light, or something stronger

The capstone should not claim "high availability" unless the design actually supports it through redundant paths and operational recovery thinking.


32.7 Observability and Operational Readiness

Every meaningful capstone should answer these questions:

  • What will be monitored?
  • Which failures trigger alarms?
  • Where will logs be collected?
  • How will operators know whether an incident is caused by traffic, code, dependency failure, or configuration drift?

At minimum, the design should include:

  • CloudWatch metrics and alarms for key service health signals
  • structured logs for important application paths
  • dashboards aligned to the workload's main user journey
  • CloudTrail and Config for audit and drift visibility

A capstone that cannot be operated is not architecturally complete.


32.8 Delivery, Environments, and Change Control

The capstone should also define how changes move safely.

Expected elements include:

  • separate environments such as sandbox, staging, and production
  • infrastructure as code for durable provisioning
  • CI/CD to build, validate, and deploy application and infrastructure changes
  • secrets and configuration managed outside source code
  • approvals or release controls where production risk justifies them

This is where many otherwise good designs become unrealistic. If the system can be drawn but not deployed safely and repeatedly, it is not ready for real use.


32.9 Cost and Architecture Trade-Off Review

The capstone should include a short cost and complexity review.

Ask:

  • Which services are always on and which scale with usage?
  • Where might hidden costs appear, such as data transfer, logging, or NAT traffic?
  • Which design choices intentionally cost more because they reduce operational or reliability risk?
  • Could a simpler design meet the same business need?

This review keeps the capstone grounded. Good architecture is not only technically sound. It is also economically sensible for the workload stage.


32.10 Common Mistakes

  • treating the capstone as a diagram exercise with no justification for service choices
  • adding many AWS services because they are available rather than because the workload needs them
  • ignoring IAM, secrets, logging, backups, and delivery workflows while focusing only on the request path
  • claiming multi-region or high availability without defining failure behavior and recovery patterns
  • designing a system the team could not realistically deploy, observe, or operate
  • skipping trade-off analysis and presenting one architecture as if it were universally correct
  • forgetting to define environment separation and change-control boundaries

32.11 Hands-On Tasks

  1. Choose a capstone workload domain and write a one-paragraph problem statement for it.
  2. Draw or describe the request path from client to data store, including edge, identity, compute, and data components.
  3. Justify one compute choice and one data-store choice against at least one realistic alternative.
  4. Define the top five CloudWatch alarms you would configure first.
  5. State the workload's expected RPO and RTO and explain which recovery pattern supports them.
  6. List the infrastructure-as-code and CI/CD controls needed before the workload should be called production-ready.

32.12 Recap

The capstone turns AWS service knowledge into architecture judgment. A strong final design connects identity, networking, compute, storage, messaging, observability, governance, recovery, and delivery into one system whose trade-offs are clear. The goal is not to build the most complex architecture. The goal is to design one that is secure, operable, scalable, and appropriate for the problem.

Next: Revisit the roadmap sections that the capstone exposed as weak points and deepen them in implementation.