AWS Architect Associate
Full AWS Solutions Architect Associate (SAA-C03) notes in 30 chapters: compute, storage, databases, networking and VPC, serverless, security, analytics, DR, with a 10 question quiz after each chapter.
Study this lesson with its quizzes on Brainbotox →
Chapter 1: IAM, Identity and Access Management
IAM controls who can do what in your AWS account. Rule number one: give every identity the least privilege it needs.
Root account, users and groups
- Root account: created with the account. Use it only for initial setup, then create your own IAM user.
- Users: one user per physical person.
- Groups: mirror your organization. A user can belong to several groups. Groups contain users only, never other groups.
- Permissions are given to users or groups through JSON policies.
Policies (JSON structure)
Write them by hand or build them in the console, which generates the JSON.
{
"Version": "2012-10-17",
"Id": "optional-id",
"Statement": [
{
"Sid": "optional-identifier",
"Effect": "Allow",
"Principal": { "AWS": ["arn:aws:iam::123456789012:root"] },
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::mybucket/*"],
"Condition": {}
}
]
}
| Field | Meaning | Required |
|---|---|---|
| Version | Policy language version | Yes |
| Id | Policy identifier | No |
| Statement | List of one or more rules | Yes |
| Sid | Statement identifier | No |
| Effect | Allow or Deny | Yes |
| Principal | Account, user or role the policy applies to | Yes (resource policies) |
| Action | API actions allowed or denied | Yes |
| Resource | Resources the actions apply to | Yes |
| Condition | When the statement is in effect | No |
Protecting accounts
- Password policy: rules on length, complexity, rotation and reuse.
- MFA: a password you know plus a device you own.
- Virtual MFA device: Google Authenticator, Authy
- U2F security key: USB key such as YubiKey
- Hardware key fob
Ways to access AWS
- Management Console: password plus MFA.
- AWS CLI: generate an access key for your user, then use it from your terminal.
- AWS CloudShell: a terminal hosted by AWS in your browser, only in some regions.
IAM roles
A role lets an AWS service (for example an EC2 instance) act on your behalf, without storing credentials on it.
IAM security tools
| Tool | Level | What it shows |
|---|---|---|
| Credentials Report | Account | All users and the status of their credentials |
| Access Advisor | User | Permissions granted and when each service was last used; use it to trim policies |
IAM best practices
- Do not use the root account except for initial setup
- One IAM user per person
- Manage permissions through groups
- Enforce a strong password policy
- Enforce MFA
- Use IAM roles to give permissions to AWS services
- Audit permissions regularly (Credentials Report, Access Advisor)
- Never share credentials or access keys
Can a group contain another group?
No. Groups contain users only.Which tool shows when a user last used a service?
IAM Access Advisor (user level).How should an EC2 instance get AWS permissions?
Through an IAM role, never by storing access keys on it.Check yourself
- What is the best practice for the AWS root account?
- An IAM group can contain other groups.
- Which IAM tool shows a user's permissions and when each service was last accessed?
- How should an EC2 instance get permission to call other AWS services?
- Which policy field names the account, user or role a policy applies to, and is required in resource based policies?
- Which fields are required in an IAM policy statement?
- Which tool lists all users in the account and the status of their credentials?
- What does MFA combine?
- Which are valid MFA device options in AWS?
- Best practice is to manage permissions by attaching policies to groups rather than to each user individually.
Chapter 2: EC2 basics, instance types and security groups
EC2 is AWS's infrastructure as a service: you rent virtual machines and pick their OS, size, network, firewall and pricing model.
What EC2 is made of
| Component | Role |
|---|---|
| EC2 instances | Virtual machines |
| EBS | Network drives that store data |
| ELB | Elastic Load Balancing, spreads traffic across instances |
| ASG | Auto Scaling Group, adds or removes instances with demand |
Configuration options
| Option | Choices |
|---|---|
| OS | Linux, macOS, Windows |
| CPU | Number of cores |
| RAM | Amount of memory |
| Storage | Network attached (EBS) or hardware (instance store) |
| Network card | Speed, public IP address |
| Firewall rules | Security groups |
| Bootstrap script | EC2 User Data |
Bootstrap (User Data): a script that runs once, at the instance's first start, to install whatever the machine needs.
Instance types
| Family | Optimized for | Example uses |
|---|---|---|
| General purpose (T, M) | Balance of CPU, memory, network | Web servers, code repositories |
| Compute optimized (C) | High CPU | Batch processing, media transcoding, high performance web servers |
| Memory optimized (R, X) | Large RAM | High performance databases, big in memory data processing |
| Storage optimized (I, D) | Fast local storage | OLTP databases, Redis cache, distributed file systems |
T is the burstable family; M is the main general purpose family.
Security groups (firewall for EC2)
- Contain allow rules only.
- Rules reference an IP range or another security group.
- Control access ports, authorized IP ranges, inbound and outbound traffic.
- Can be attached to multiple instances.
- Locked to one region and VPC combination.
- Live outside the instance: blocked traffic never reaches it.
- Good practice: a separate security group for SSH access.
- A connection timeout is usually a security group problem.
Ports to know (tap a card to reveal the port)
Connecting and access rights
- Default user on Amazon Linux AMI:
ec2-user. - EC2 Instance Connect: browser based terminal, no SSH key management.
- Access rights: never type your own credentials (
aws configure) into an instance, anyone connecting to it could retrieve them. Attach an IAM role instead.
Your SSH connection times out. First suspect?
The security group: port 22 is probably not open to your IP.Can a security group contain a deny rule?
No. Security groups only contain allow rules.Which family for an in memory database?
Memory optimized (R series).Check yourself
- Your SSH connection to an EC2 instance times out. What is the most likely cause?
- Security groups can contain both allow and deny rules.
- Which instance family fits a high performance in memory database?
- What runs a bootstrap script once, at an instance's first start?
- Which port does RDP (Windows remote desktop) use?
- Which instance family suits batch processing and media transcoding?
- Which statements about security groups are true?
- What is the default user on an Amazon Linux AMI?
- Which option gives a browser based terminal into an instance without managing SSH keys?
- Which family suits OLTP databases and distributed file systems that need fast local storage?
Chapter 3: EC2 pricing, spot, networking and hibernate
How you pay for EC2, how spot instances work, and how instances get IPs and are placed on hardware.
Purchase options
| Option | Discount | Commitment | Best for |
|---|---|---|---|
| On demand | None | None | Short, uninterrupted workloads |
| Reserved Instances | Up to 72% | 1 or 3 years | Long, steady workloads |
| Savings Plans | Up to 72% | 1 or 3 years, $ per hour | Long workloads, flexible size and OS |
| Spot Instances | Up to 90% | None | Short, failure tolerant workloads |
| Dedicated Hosts | Varies | On demand or 1 to 3 years | Compliance, per server licences |
| Dedicated Instances | Varies | None | Hardware not shared with other customers |
| Capacity Reservations | None | None | Guaranteed capacity in one AZ |
Max discount at a glance
On demand
- Linux and Windows: billed per second after the first minute. Other OS: per hour.
- No upfront payment, no commitment.
Reserved Instances
- Reserve specific attributes: instance type, region, tenancy, OS.
- 1 or 3 years. Payment: no upfront, partial upfront, all upfront (more upfront, bigger discount).
- Scope: regional or zonal. Sell unused ones on the Reserved Instance Marketplace.
- Convertible RI: can change type, family, OS, scope and tenancy, for a smaller discount.
Savings Plans
- Commit to a spend, for example $10 per hour, for 1 or 3 years. Usage above it is billed at on demand price.
- EC2 Instance Savings Plans: locked to an instance family and region (for example m5 in us-east-1), but flexible on size (m5.xlarge, m5.2xlarge), OS and tenancy. Biggest Savings Plan discount.
- Compute Savings Plans: not locked to a family or region, and also cover Fargate and Lambda. Most flexible, slightly smaller discount.
Spot Instances
- You can set the max price you are willing to pay (optional, defaults to the on demand price). If the spot price goes above it, or AWS needs the capacity back, you lose the instance.
- The spot price moves gradually with long term supply and demand. There is no live bidding (AWS dropped that model in 2017).
- For failure tolerant work: batch jobs, data analysis, image processing. Not for critical jobs or databases.
Dedicated Hosts
- A whole physical server for you, with visibility on sockets and cores.
- For compliance and bring your own licence (per socket, core or VM, e.g. SQL Server). You control placement. Most expensive.
Dedicated Instances
- Hardware dedicated to you, but not a full server; may share hardware with other instances in your account. No control over placement.
Capacity Reservations
- Reserve on demand capacity in a specific AZ, any duration, cancel any time, no discount.
- Billed at on demand rate whether the instance runs or not.
Spot instances in depth
- If the spot price goes above your max, or AWS reclaims the capacity, you get a 2 minute warning to stop or terminate (action can be predefined).
- One time request: once the instance is lost, it's over.
- Persistent request: the instance comes back when capacity and price allow.
- To stop relaunches: cancel the request first (open, active or disabled state), then terminate the instances yourself.
- Spot Fleet: spot plus optional on demand instances, meeting a target capacity within a price limit. You define launch pools (type, OS, AZ).
| Allocation strategy | Picks from |
|---|---|
| lowestPrice | The pool with the lowest price |
| diversified | All pools, for availability |
| capacityOptimized | The pool with the most capacity |
| priceCapacityOptimized | Recommended: highest capacity pools first, then lowest price |
IP addresses
- A public IPv4 changes every time you stop and start the instance. The private IP stays.
- For a fixed public IP, use an Elastic IP. Every public IPv4 costs about $0.005 per hour.
Placement groups
| Strategy | Placement | Limit | Use case |
|---|---|---|---|
| Cluster | Close together, single AZ | None | Low latency, high throughput; one rack failure hits all |
| Spread | Each on different hardware | 7 instances per AZ per group | Critical apps, maximum availability |
| Partition | Partitions on separate racks | 7 partitions per AZ, hundreds of instances | Big data (HDFS, Cassandra, Kafka) |
Elastic Network Interface (ENI)
- A virtual network card: one primary private IPv4, plus secondary ones, one Elastic IP per private IPv4.
- Bound to a specific AZ.
- Can be moved to another instance, useful for network failover between two instances running the same app.
EC2 Hibernate
Like putting your PC to sleep: faster restart because the OS does not boot again.
- RAM is saved to the root EBS volume.
- Root EBS must be encrypted and large enough to hold the RAM.
- Max 60 days hibernated.
Cheapest for interruptible batch jobs?
Spot instances, up to 90% off.Licences tied to physical cores?
Dedicated Hosts.Lowest latency between instances?
Cluster placement group.Does cancelling a spot request terminate instances?
No. Cancel the request, then terminate the instances yourself.Commit to spend but move between regions and use Lambda?
Compute Savings Plans.Check yourself
- Which purchase option gives the biggest discount for a failure tolerant batch job?
- You must use server bound software licences and control instance placement. Which option?
- Which placement group gives the lowest network latency between instances?
- Cancelling a persistent spot request automatically terminates its running instances.
- Which statements about EC2 Hibernate are true?
- What happens to an instance's public IPv4 address when you stop and start it?
- How many instances per AZ can a spread placement group hold?
- Which Spot Fleet allocation strategy is recommended, picking the highest capacity pools first, then the lowest price?
- Which option reserves on demand capacity in a specific AZ, with no discount, billed whether the instance runs or not?
- A Kafka or Cassandra cluster of hundreds of instances must spread across racks. Which placement group?
Chapter 4: EBS, AMI, instance store and EFS
Storage for EC2: network disks (EBS), machine images (AMI), local disks (instance store) and shared file systems (EFS).
EBS volume (Elastic Block Store)
- A network drive you attach to an instance.
- Bound to one AZ. To move it to another AZ, snapshot it first.
- Attached to one instance at a time (except io1/io2 multi attach), but one instance can have several EBS volumes.
- Root EBS is deleted with the instance by default. You can change this to preserve it. Other volumes are kept by default.
EBS snapshots
- A backup of the volume at a point in time. Can be copied across AZ and region.
- Snapshot Archive: 75% cheaper, but 24 to 72 hours to restore.
- Recycle Bin: rules to keep deleted snapshots so you can recover them after an accidental delete. Retention 1 day to 1 year.
- Fast Snapshot Restore (FSR): full initialisation, no latency on first use. Expensive ($$$).
AMI (Amazon Machine Image)
A custom EC2 template: your OS, software and config pre-packaged, so instances boot and configure faster.
- Built for a specific region, and can be copied to other regions.
- Types: public AMI (AWS provided), your own AMI (a "golden AMI"), AWS Marketplace AMI (made and sometimes sold by others).
Process
- Start an EC2 instance and customise it.
- Stop it, for data integrity.
- Build an AMI from it (this also creates EBS snapshots).
- Launch new instances from the AMI.
EC2 instance store
- A real hardware disk physically attached to the host. Use it when EBS performance is not enough.
- Much better I/O performance.
- Ephemeral: data is lost if the instance is stopped or the hardware fails.
- Good for buffer, cache, scratch and temporary content.
- Backups and replication are your responsibility.
EBS volume types
| Type | Disk | Use |
|---|---|---|
| gp2 / gp3 | SSD | General purpose, balance of price and performance |
| io1 / io2 Block Express | SSD | Highest performance, low latency, high throughput |
| st1 | HDD | Low cost, frequently accessed, throughput heavy |
| sc1 | HDD | Lowest cost, less frequently accessed |
Only gp2/gp3 and io1/io2 can be boot volumes.
General purpose SSD
- gp2: 1 GB to 16 TB. 3 IOPS per GB, so IOPS are tied to size. Max 16,000 IOPS.
- gp3 (newer): baseline 3,000 IOPS and 125 MB/s at any size. You can raise IOPS and throughput independently of size: since September 2025, up to 80,000 IOPS and 2,000 MB/s, on volumes up to 64 TB.
Provisioned IOPS SSD (PIOPS)
- For the most demanding databases: highest sustained IOPS, lowest latency and the most consistent performance.
- io1: 4 GB to 16 TB. Max 64,000 IOPS on Nitro instances, 32,000 on others. IOPS set independently of size.
- io2 Block Express: 4 GB to 64 TB, sub-millisecond latency, max 256,000 IOPS, ratio 1,000 IOPS per GB.
- Supports multi attach (see below).
EBS multi attach
- io1/io2 only: one volume attached to several instances in the same AZ.
- Each instance has full read and write access.
- Max 16 instances.
- Must use a cluster-aware file system.
EBS encryption
- When a volume is encrypted, the data at rest, the data in flight, all snapshots and all volumes created from those snapshots are encrypted.
- Handled transparently, minimal impact on latency.
- Uses KMS keys (AES-256).
- To encrypt an unencrypted volume: snapshot it, copy the snapshot with encryption on, create a volume from it.
EFS (Elastic File System)
- Managed network file system (NFS) that can be mounted on many EC2 instances, across multiple AZ.
- Highly available, scalable, expensive. Pay per use, no capacity planning, it grows and shrinks on its own.
- Access controlled with security groups. Encryption at rest with KMS.
- Linux AMIs only (POSIX), not Windows.
Scale and performance mode
- Thousands of concurrent clients.
- Performance mode, set at creation: General Purpose (default, low latency, web servers, CMS) or Max I/O (higher latency, higher throughput, highly parallel, big data).
Throughput mode
- Bursting: 1 TB gives 50 MB/s, with bursts up to 100 MB/s.
- Provisioned: set your throughput regardless of storage size.
- Elastic: scales up and down automatically with the workload. Recommended for unpredictable workloads.
Storage classes
- Standard: frequently accessed files.
- Infrequent Access (IA): cost to retrieve a file, lower storage price.
- Archive: rarely accessed data (a few times a year), about 50% cheaper.
- Availability: multi-AZ (production) or One Zone (dev, cheaper).
- Lifecycle policies move files to a cheaper tier after N days without access.
Move an EBS volume to another AZ?
Snapshot it, then restore the snapshot in the other AZ.Highest disk I/O, data loss acceptable?
EC2 instance store.Need 10,000 IOPS on a small volume, cheapest SSD?
gp3, since its IOPS are independent of size.Shared file system for 50 Linux instances across AZ?
EFS.Which EBS types can be boot volumes?
gp2, gp3, io1, io2. Never st1 or sc1.Check yourself
- How do you move an EBS volume to another Availability Zone?
- Which EBS volume types can be used as boot volumes?
- Which gp volume lets you set IOPS independently of its size?
- You need the highest disk I/O and losing data on stop is acceptable. What do you use?
- EFS can be mounted on Windows EC2 instances.
- What is the maximum number of instances an io1/io2 volume can be multi attached to?
- How do you encrypt an existing unencrypted EBS volume?
- By default, the root EBS volume is deleted when its instance is terminated.
- Which EBS snapshot feature is about 75% cheaper but takes 24 to 72 hours to restore?
- A highly parallel big data job runs on EFS and can accept higher latency for more throughput. Which performance mode?
Chapter 5: Elastic Load Balancing
How ELB spreads traffic, the four LB types, sticky sessions, cross zone, TLS and draining.
The four types
| Type | Year | Protocols | Notes |
|---|---|---|---|
| Classic (CLB) | 2009 | HTTP, HTTPS, TCP, SSL | Old generation, deprecated |
| Application (ALB) | 2016 | HTTP, HTTPS, WebSocket | Layer 7 |
| Network (NLB) | 2017 | TCP, TLS, UDP | Layer 4, high performance |
| Gateway (GWLB) | 2020 | IP packets | Layer 3, security appliances |
Security groups
- The LB security group allows external traffic (HTTP/HTTPS from anywhere).
- The EC2 security group allows traffic only from the LB security group (link SG to SG).
Application Load Balancer
- Routes to different target groups with rules on: path in URL, hostname in URL, query string, headers.
- Target groups can be EC2 instances, ECS tasks, Lambda functions, or private IP addresses.
- Great for microservices and containers (Docker, ECS). Has a port mapping feature to redirect to a dynamic port in ECS.
- Fixed hostname, no Elastic IP.
- The app server does not see the client IP directly. It is inserted in the header X-Forwarded-For (also X-Forwarded-Port and X-Forwarded-Proto).
Network Load Balancer
- Lower level: forwards TCP and UDP traffic.
- One static IP per AZ, and supports assigning an Elastic IP.
- Ultra low latency, millions of requests per second. Good for performance.
Gateway Load Balancer
- Deploy, scale and manage a fleet of third party virtual network appliances: firewalls, intrusion detection, deep packet inspection.
- Operates at layer 3 (network layer), on IP packets.
- Distributes traffic to your virtual appliances.
- Uses the GENEVE protocol on port 6081.
Sticky sessions (session affinity)
- Available on CLB, ALB and NLB.
- A cookie, with an expiry you control, sends the same user to the same instance so they don't lose their session.
Application based cookies
- Custom cookie: generated by the target, can include any attribute. The name is set per target group and must not be AWSALB, AWSALBAPP or AWSALBTG (reserved).
- Application cookie: generated by the LB, name is AWSALBAPP.
Duration based cookie
- Generated by the LB. Name AWSALB for ALB, AWSELB for CLB.
Cross zone load balancing
Spreads traffic evenly across all instances in all AZ, not just evenly across AZ. Example: AZ1 has 2 instances, AZ2 has 8, the LB sends 50% to each AZ.
| LB | Default | Inter-AZ cost |
|---|---|---|
| ALB | Enabled (can disable per target group) | No charge |
| NLB and GWLB | Disabled | You pay if you enable it |
| CLB | Disabled | No charge if enabled |
SSL/TLS
- A certificate encrypts traffic in transit between clients and the LB (in flight encryption).
- TLS is the newer version of SSL.
- LBs use X.509 certificates, managed with ACM (AWS Certificate Manager).
SNI (Server Name Indication)
- Solves loading multiple SSL certificates on one web server, so one LB serves several websites.
- Newer protocol: the client indicates the target hostname in the initial SSL handshake.
- Only with ALB, NLB and CloudFront (not CLB).
Connection draining
- Called Connection Draining on CLB, Deregistration Delay on ALB and NLB.
- Time given to complete in flight requests while an instance is de-registering or unhealthy.
- The LB stops sending new requests to the instance in draining mode.
- 1 to 3,600 seconds (default 300), 0 disables it. Set it low if your requests are short.
Need a static IP or Elastic IP on the LB?
NLB.Route /users and /orders to different services?
ALB with path based rules.How does the app get the client IP behind an ALB?
X-Forwarded-For header.Inspect all traffic through third party firewalls?
GWLB, GENEVE on port 6081.Several HTTPS sites behind one LB?
SNI, on ALB or NLB.Check yourself
- Which load balancer gives you a static IP per AZ and supports Elastic IPs?
- Behind an ALB, how does your app read the client's real IP?
- Which protocol and port does the Gateway Load Balancer use?
- Cross zone is off. AZ1 has 2 instances, AZ2 has 8, the LB sends 50% to each AZ. What does each AZ2 instance get?
- Which feature lets one load balancer serve several websites, each with its own SSL certificate?
- How should the EC2 instances' security group be set up behind a load balancer?
- You need to route /users and /orders to different target groups. Which load balancer?
- What is connection draining called on ALB and NLB, and what is its default?
- What is the default cross zone setting on an NLB?
- An Application Load Balancer can be assigned an Elastic IP.
Chapter 6: Auto Scaling Groups
Add and remove EC2 instances automatically to match the load.
What an ASG does
- Scale out: add instances when load goes up.
- Scale in: remove instances when load goes down.
- You set a minimum, desired and maximum capacity.
- Works with a load balancer: new instances are registered automatically and receive traffic. Unhealthy ones are replaced.
- The ASG itself is free, you only pay for the instances.
Launch template vs ASG settings
The launch template describes what each new instance looks like:
- AMI and instance type
- EC2 user data
- EBS volumes
- Security groups
- SSH key pair
- IAM role for your instances
- Network settings (optional)
The ASG itself holds where and how many:
- Subnets / AZ to launch into
- Minimum, desired and maximum capacity
- The load balancer target group instances are registered with
- Health checks and scaling policies
You can scale in or out based on CloudWatch alarms, which monitor a metric such as average CPU.
Use a ready made AMI to reduce configuration time, so new instances serve requests faster.
Scaling policies
| Policy | How it works | Example |
|---|---|---|
| Target tracking | Dynamic, simplest. Keep a metric at a target. | Keep average CPU at 40% |
| Simple / step | Dynamic, triggered by CloudWatch alarms | CPU over 70%: add 2. Under 30%: remove 1 |
| Scheduled | Anticipate a known pattern | Raise minimum to 10 every Friday at 5 pm |
| Predictive | Analyses historical data, forecasts load, schedules scaling actions ahead | Daily traffic peaks |
Good metrics to scale on
- CPUUtilization
- RequestCountPerTarget (requests per EC2)
- Average Network In / Out
- Any custom CloudWatch metric
Cooldown
- After a scaling action there is a cooldown period (default 300 s).
- During it, the ASG launches or terminates nothing more, so metrics can stabilise.
Keep average CPU around 40% with the least setup?
Target tracking policy.Big known event every Monday morning?
Scheduled scaling.Why does the ASG wait after scaling?
The 300 s default cooldown lets metrics stabilise.How to make new instances ready faster?
Use a pre-baked AMI to cut boot and config time.Where do you attach the load balancer: launch template or ASG?
The ASG, through its target group.Check yourself
- You want an ASG to keep average CPU at about 40% with the least configuration. Which policy?
- What is the default ASG cooldown after a scaling action?
- You need to raise the minimum capacity to 10 every Friday at 5 pm. Which policy?
- Which policy analyses historical data, forecasts load and schedules scaling actions ahead of time?
- You pay an hourly fee for the Auto Scaling Group itself, on top of the instances.
- Which capacity values do you set on an ASG?
- What does an ASG do with an instance that fails its health check behind a load balancer?
- Which are good metrics to scale an ASG on?
- How can you make newly launched instances start serving requests faster?
- What triggers simple and step scaling policies?
Chapter 7: RDS and Aurora
AWS managed relational databases: replicas, Multi-AZ, Aurora's architecture, backups, security and RDS Proxy.
RDS (Relational Database Service)
Engines: PostgreSQL, MySQL, MariaDB, Oracle, SQL Server, IBM Db2, and Aurora (AWS's own).
A managed service, so you get by default:
- Automated provisioning and OS patching
- Continuous backups and point in time restore
- Monitoring dashboards
- Read replicas
- Multi-AZ for disaster recovery
- Maintenance windows for upgrades
- Vertical and horizontal scaling
- Storage backed by EBS
You can't SSH into an RDS instance, it's a service (except RDS Custom).
Storage auto scaling
- Detects when you are running out of space and increases storage dynamically.
- You set a maximum storage threshold.
Read replicas vs Multi-AZ
| Read replicas | Multi-AZ (instance deployment) | |
|---|---|---|
| Goal | Scale reads | Disaster recovery |
| How many | Up to 15 | One standby |
| Where | Same AZ, cross AZ or cross region | A different AZ |
| Replication | Asynchronous | Synchronous |
| Readable? | Yes, app connects to them | No, not used for scaling |
| Failover | Can be promoted to its own DB | Automatic, one DNS name switches over |
- Use case: a reporting app reads from a replica so it doesn't overload the main DB.
- Network cost: replication between AZ in the same region is free (managed service). Cross region replication is paid.
- A read replica can be set up as Multi-AZ for DR.
- Single AZ to Multi-AZ: zero downtime, just modify the database option.
- Multi-AZ DB cluster (MySQL and PostgreSQL): a second Multi-AZ option with one writer and two readable standbys in different AZ. Faster failover, and the standbys can also serve reads.
RDS Custom
- For Oracle and SQL Server.
- Gives you access to the database and the OS of the underlying EC2 instance, even though it's a managed service.
- Always take a snapshot before touching the underlying config.
Amazon Aurora
- Compatible with PostgreSQL and MySQL drivers.
- Cloud optimised by AWS, faster than standard RDS engines.
- Storage grows automatically.
- Up to 15 read replicas, failover is near instantaneous.
High availability and read scaling
- 6 copies of your data across 3 AZ. 4 of 6 needed for writes, 3 of 6 for reads.
- Self healing, storage is striped across hundreds of volumes.
- 1 master (writes) plus up to 15 read replicas. Cross region supported.
Endpoints
- Writer endpoint: always points to the master.
- Reader endpoint: load balances across all read replicas.
- Custom endpoint: aims at a specific subset of replicas, for example the 2 most powerful for analytics.
Aurora Serverless
- Automated scaling based on actual usage. Good for unpredictable or intermittent workloads.
- No capacity planning, pay per second, can be more cost effective.
Global Aurora
- Cross region read replicas: useful for DR, simple to set up.
- Aurora Global Database (recommended): 1 primary region (read and write), up to 10 secondary read only regions, replication lag under 1 second, up to 16 read replicas per secondary region, decreased latency. Promoting another region takes under 1 minute.
Other features
- Machine learning: simple integration with AWS ML services (SageMaker, Comprehend). Use cases: fraud detection, ads targeting, sentiment analysis.
- Babelfish for Aurora PostgreSQL: lets Aurora PostgreSQL understand commands meant for MS SQL Server (T-SQL).
- Aurora cloning: create a new cluster from an existing one, super fast, using copy on write. Example: build staging from production.
Backups and restore
| RDS | Aurora | |
|---|---|---|
| Automated backups | Daily full backup plus transaction logs every 5 min, point in time restore | Point in time recovery |
| Retention | 1 to 35 days, set 0 to disable | 1 to 35 days, cannot be disabled |
| Manual snapshots | Manually triggered, kept as long as you want | Same |
Restore options
- Restoring an RDS or Aurora backup creates a new database.
- Restore MySQL RDS from S3: put an on-premises backup in S3, restore it to a new RDS instance.
- Restore Aurora MySQL from S3: create the backup with Percona XtraBackup, then restore it to a new cluster.
RDS and Aurora security
- At rest encryption with KMS, defined at launch time.
- In flight encryption: TLS ready by default, use the AWS TLS root certificate client side.
- IAM authentication: connect with IAM roles instead of username and password.
- Security groups control network access.
- No SSH, except RDS Custom.
- Audit logs can be enabled (and sent to CloudWatch Logs).
RDS Proxy
- Pools and shares DB connections, reducing stress on the DB (CPU, RAM, open connections).
- Serverless and auto scaled, highly available.
- Reduces failover time by up to 66%.
- Enforces IAM authentication, credentials stored in AWS Secrets Manager.
- Never publicly accessible, only from within the VPC.
Scale reads for a reporting tool?
Read replica, app connects to its endpoint.Survive an AZ outage automatically?
RDS Multi-AZ (synchronous standby, DNS failover).Aurora writes need how many copies?
4 of 6. Reads need 3 of 6.Many Lambda functions opening DB connections?
RDS Proxy.Need OS access on a managed Oracle DB?
RDS Custom.Fast staging copy of a production Aurora DB?
Aurora cloning.Check yourself
- What is the main purpose of RDS Multi-AZ?
- How many copies of data does Aurora keep, and across how many AZ?
- Aurora automated backups can be disabled by setting retention to 0.
- Thousands of Lambda functions are exhausting database connections. What helps most?
- A reporting tool is overloading your main database with reads. What do you add?
- You need access to the OS of a managed Oracle database. Which option?
- What is the fastest way to build a staging copy of a production Aurora database?
- Which Aurora endpoint load balances connections across all read replicas?
- Converting an RDS database from Single-AZ to Multi-AZ requires downtime.
- With Aurora Global Database, how long does promoting another region take?
Chapter 8: ElastiCache and database ports
Managed in-memory caches (Redis or Memcached) to take load off your database.
What it is
- Managed Redis or Memcached.
- Used as a cache in front of a DB to speed up queries and reduce DB load.
- AWS manages the OS, patching, setup, failure recovery and monitoring.
- Can store user sessions so the app stays stateless.
- Usually needs application code changes to use it.
Redis vs Memcached
| Redis | Memcached |
|---|---|
| Multi-AZ with auto failover | Multi-node for partitioning (sharding) of data |
| Read replicas for high availability | No high availability (no replication) |
| Data durability with AOF persistence | Not persistent |
| Backup and restore | Backup and restore (serverless) |
| Supports sets and sorted sets | Multi-threaded architecture |
| IAM authentication |
Security
- Redis AUTH: set a password or token when you create the Redis cluster. Supports SSL in flight encryption.
- Memcached: supports SASL based authentication.
Caching patterns
- Lazy loading: all read data is cached. Data in the cache can become stale.
- Write through: add or update the cache whenever data is written to the DB. No stale data.
- Session store: store temporary session data, with a TTL.
Use case: gaming leaderboard
- Redis sorted sets guarantee uniqueness and element ordering.
- Each time an element is added, it's ranked in real time and placed in the right order.
Database ports to know
Tap a database to reveal its port.
Real time leaderboard?
ElastiCache for Redis, sorted sets.Cache needs HA and persistence?
Redis, not Memcached.Simple multi-threaded cache, data loss acceptable?
Memcached.Avoid stale cache data?
Write through pattern.Check yourself
- You need a real time gaming leaderboard. What fits best?
- Which port does Oracle use by default?
- Your cache needs high availability, persistence and backups. Which engine?
- Which caching pattern updates the cache every time data is written to the database, so it is never stale?
- What is the main drawback of lazy loading?
- Which default port do MySQL and MariaDB use?
- Which default port does SQL Server use?
- How does Memcached authenticate clients?
- Using ElastiCache usually requires changes to your application code.
- Which features belong to Memcached?
Chapter 9: Route 53
AWS's DNS service: records, hosted zones, CNAME vs Alias, routing policies and health checks.
Basics
- Highly available, scalable, fully managed and authoritative DNS: you can update the DNS records yourself.
- Also a domain registrar.
- The only AWS service with a 100% availability SLA.
Each record has
- Domain or subdomain name, e.g.
example.com - Record type: A, AAAA, CNAME, NS...
- Value, e.g. an IP address
- Routing policy
- TTL: how long the record is cached by resolvers and clients
Record types
| Type | Maps |
|---|---|
| A | Hostname to IPv4 |
| AAAA | Hostname to IPv6 |
| CNAME | Hostname to another hostname (which must have an A or AAAA record) |
| NS | Name servers for the hosted zone |
You can't create a CNAME for the top node of a DNS namespace (zone apex): example.com ✗, www.example.com ✓.
Hosted zones
- Public hosted zone: records for routing internet traffic.
- Private hosted zone: records for routing within one or more VPCs.
- $0.50 per month per hosted zone.
Record TTL
- Cached on the client side (browser, resolver).
- High TTL (24 h): less traffic to Route 53, but possibly outdated records.
- Low TTL (60 s): more traffic (more cost), records are fresher, easy to change.
- Lower the TTL before a planned change.
CNAME vs Alias
| CNAME | Alias | |
|---|---|---|
| Points to | Any hostname | An AWS resource (ELB, CloudFront, S3 website, API Gateway...) |
| Root domain | Non root only (api.mydomain.com) | Root and non root (mydomain.com) |
| Health check | No | Native health check |
| Cost | Charged queries | Free |
You cannot set an Alias record for an EC2 DNS name.
Routing policies
| Policy | How it routes |
|---|---|
| Simple | One resource, or multiple values in one record and the client picks one at random. No health checks. |
| Weighted | A % of requests to each resource. Records must have the same name and type. |
| Latency based | To the resource with the least latency for the user. Can use health checks. |
| Failover | Active/passive: primary while its health check is OK, secondary otherwise. |
| Geolocation | Based on user location (continent, country, US state). Create a default record for no match. |
| Geoproximity | By distance to resources, shifted with a bias: the higher the bias, the more traffic goes to that region. |
| IP based | By client IP: you provide CIDR blocks mapped to endpoints (e.g. 203.0.113.0/24 to location 1). |
| Multi-value | Returns multiple healthy records, the client picks. Can use health checks. Not a substitute for an ELB. |
Health checks
- Monitor an endpoint (app, server, other AWS resource), e.g. by region or an ALB.
- About 15 global health checkers. Threshold of 3 by default. Healthy if more than 18% of checkers say OK.
- Protocols: HTTP, HTTPS, TCP.
Calculated health checks
- Combine child health checks with OR, AND, NOT into one parent.
- Up to 256 child health checks.
Private hosted zones
- Route 53 health checkers live outside the VPC, so they can't reach private endpoints (private VPC or on premises).
- Fix: create a CloudWatch metric with an alarm, then a health check that checks the alarm.
Domain registrar vs DNS service
- You buy a domain from a registrar (GoDaddy, Amazon Registrar...). It usually provides its own DNS service, but you don't have to use it.
- You can combine the two: register with GoDaddy, create a public hosted zone in Route 53, then set GoDaddy's name servers to the Route 53 name servers.
Point example.com (apex) to an ALB?
Alias record. A CNAME can't be used at the zone apex.Send 10% of traffic to a new version?
Weighted routing.Serve EU users from the EU for legal reasons?
Geolocation routing (plus a default record).Shift more traffic toward one region gradually?
Geoproximity with a higher bias.Health check a private resource?
CloudWatch alarm, then a health check on the alarm.Check yourself
- You want example.com (the zone apex) to point to an ALB. Which record?
- Which Route 53 policy sends a chosen percentage of traffic to each resource?
- How do you health check a resource inside a private VPC with Route 53?
- EU users must be served from the EU for legal reasons. Which routing policy?
- You want to gradually shift more traffic toward one region using a bias. Which policy?
- Which AWS service has a 100% availability SLA?
- What should you do with a record's TTL before a planned change?
- You can create an Alias record that points to an EC2 instance's DNS name.
- How do calculated health checks combine child health checks?
- Your domain is registered with GoDaddy but you want Route 53 to manage DNS. What do you do?
Chapter 10: Hybrid DNS, fast app deployment and Elastic Beanstalk
Route 53 Resolver for hybrid networks, ways to start apps fast, and Elastic Beanstalk.
Route 53 Resolver (hybrid DNS)
By default, the Route 53 Resolver in a VPC answers DNS queries for:
- Local domain names of EC2 instances
- Records in private hosted zones
- Records in public name servers
Hybrid DNS: resolve queries between your VPC and your other networks (other DNS resolvers). The other network can be:
- A peered VPC
- An on-premises network connected through Direct Connect or AWS VPN
Resolver endpoints
- Inbound endpoint: lets your on-prem DNS resolvers resolve AWS names, e.g. EC2 instances and records in private hosted zones.
- Outbound endpoint: Route 53 Resolver forwards queries to your on-prem DNS resolvers (using forwarding rules).
Instantiating applications quickly
| Resource | How to make it start fast |
|---|---|
| EC2 | Golden AMI: install everything once, then launch instances from that AMI. Bootstrap with User Data for dynamic config. Hybrid: golden AMI plus User Data (what Beanstalk does). |
| RDS | Restore from a snapshot: data and schema are ready. |
| EBS | Restore from a snapshot: the disk is already formatted with data. |
Elastic Beanstalk
- A managed service and a developer-centric central view for deploying an app.
- Uses all the components we've seen: EC2, ASG, ELB, RDS.
- Automatically handles capacity provisioning, load balancing, scaling, health monitoring and instance config.
- Free, you pay for the underlying instances.
- You still have full control over the configuration.
3 components
- Application: collection of Beanstalk components (environments, versions, configs).
- Application version: an iteration of your app code.
- Environment: collection of AWS resources running one version.
Tiers: web server tier and worker tier.
You can run multiple environments (dev, test, prod).
Deployment modes
| Mode | What you get | Best for |
|---|---|---|
| Single instance | 1 EC2 with an Elastic IP | Dev |
| High availability with LB | ALB, ASG, RDS Multi-AZ | Prod |
On-prem servers must resolve names in a private hosted zone?
Route 53 Resolver inbound endpoint.EC2 instances must resolve an on-prem domain?
Outbound endpoint with a forwarding rule.Fastest way to boot preconfigured EC2 instances?
Golden AMI, plus User Data for anything dynamic.Deploy a web app without managing EC2, ASG and ELB yourself?
Elastic Beanstalk.Check yourself
- Your on-prem DNS servers must resolve records in a Route 53 private hosted zone. What do you create?
- EC2 instances in your VPC must resolve names in an on-prem domain. What do you set up?
- What is the fastest way to boot preconfigured EC2 instances that still need some dynamic config?
- How do you get a new RDS database with data and schema ready instantly?
- Elastic Beanstalk itself is free: you pay only for the underlying resources.
- In Elastic Beanstalk, what is an iteration of your app code called?
- Which are Elastic Beanstalk environment tiers?
- Which Beanstalk mode gives one EC2 instance with an Elastic IP, ideal for dev?
- Hybrid DNS with Route 53 Resolver can work with which networks?
- By default, the Route 53 Resolver in a VPC answers queries for which names?
Chapter 11: S3 basics, policies, versioning and replication
Buckets and objects, who can access them, versioning and replication.
Use cases
Backup and storage, disaster recovery, archive, hybrid cloud storage, application hosting, media hosting, data lakes and big data analytics, static websites.
Buckets and objects
- Buckets are top level directories; files are objects.
- A bucket name must be globally unique (across all accounts), but a bucket lives in one region.
- Each object has a key, which is its full path:
s3://my-bucket/my_folder/my_file.txt. There are no real folders, just keys with slashes. - Max object size: 5 TB.
- Above 5 GB you must use multipart upload.
S3 security
- User based: IAM policies, which API calls a user is allowed to make.
- Resource based:
- Bucket policies: bucket wide rules, allow cross account access.
- Object ACL: fine grained (can be disabled).
- Bucket ACL: less common (can be disabled).
- Encryption of objects (see the encryption chapter).
Bucket policy structure (JSON)
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "PublicRead",
"Effect": "Allow",
"Principal": "*",
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::my-bucket/*"]
}]
}
- Resource: buckets and objects
- Effect: Allow or Deny
- Actions: set of APIs to allow or deny
- Principal: the account or user the policy applies to
Use bucket policies to
- Grant public access to the bucket
- Force objects to be encrypted at upload
- Grant access to another account (cross account)
Versioning
- Enabled at the bucket level.
- Uploading a file with the same key creates a new version (1, 2, 3...).
- Best practice: protects against unintended deletes and lets you roll back.
Replication (CRR and SRR)
- Versioning must be enabled on source and destination buckets.
- CRR (Cross Region Replication) or SRR (Same Region Replication).
- Asynchronous. Buckets can be in different AWS accounts.
- S3 needs the right IAM permissions.
Delete operations
- Delete markers can be replicated (optional setting).
- Deletions with a version ID are not replicated (protects against malicious deletes).
No chaining
If 1 replicates to 2 and 2 replicates to 3, objects from bucket 1 are not copied to bucket 3.
Athena
A serverless query service to run SQL queries directly on files in S3.
Uploading a 20 GB file?
Multipart upload is required above 5 GB.Let another AWS account read your bucket?
Bucket policy with that account as principal.Turned on CRR, old files didn't copy. Why?
Replication only applies to new objects. Use S3 Batch Replication for existing ones.Requirement before setting up replication?
Versioning on both buckets.Check yourself
- What is the maximum size of a single S3 object?
- You enabled S3 replication on a bucket with existing files. How do you copy the existing objects?
- How do you upload a 20 GB file to S3?
- S3 bucket names only need to be unique within your own account.
- What must be enabled before you can set up S3 replication?
- How do you let another AWS account read objects in your bucket?
- If bucket 1 replicates to bucket 2, and bucket 2 replicates to bucket 3, objects from bucket 1 also reach bucket 3.
- What happens to deletions made with a specific version ID when replication is on?
- Which serverless service lets you run SQL queries directly on files in S3?
- What is an S3 object key?
Chapter 12: S3 storage classes and lifecycle
Pick the class by how often you read the data and how fast you need it back.
Durability vs availability
- Durability: 99.999999999% (11 nines), the same for all classes. Store 10,000,000 objects and expect to lose one every 10,000 years.
- Availability varies by class. Standard is 99.99%, which means about 53 minutes a year not available.
You can change an object's class manually, or automatically with lifecycle rules.
The classes
| Class | Availability | Key facts | Use cases |
|---|---|---|---|
| Standard | 99.99% | General purpose, low latency, high throughput, survives 2 concurrent facility failures | Big data, mobile and gaming apps, content distribution |
| Standard-IA | 99.9% | Less frequent access but rapid when needed. Lower storage cost, retrieval fee | DR, backups |
| One Zone-IA | 99.5% | High durability in a single AZ. Data lost if the AZ is destroyed | Secondary backups, data you can recreate |
| Glacier Instant Retrieval | Millisecond retrieval. Min storage 90 days | Data accessed about once a quarter | |
| Glacier Flexible Retrieval | Expedited 1 to 5 min, Standard 3 to 5 h, Bulk 5 to 12 h (free). Min 90 days | Archives | |
| Glacier Deep Archive | Standard 12 h, Bulk 48 h. Min 180 days. Cheapest | Long term storage | |
| Intelligent-Tiering | Moves objects between tiers automatically | Unknown or changing access patterns |
All Glacier classes: low cost for archiving and backup, you pay for storage plus retrieval.
Intelligent-Tiering
- Small monthly monitoring and auto-tiering fee.
- Moves objects automatically between access tiers based on usage.
- No retrieval charges.
| Tier | When |
|---|---|
| Frequent Access | Automatic, the default tier |
| Infrequent Access | Automatic, objects not accessed for 30 days |
| Archive Instant Access | Automatic, not accessed for 90 days |
| Archive Access | Optional, configurable from 90 to 700+ days |
| Deep Archive Access | Optional, configurable from 180 to 700+ days |
S3 Express One Zone
- High performance class in a single AZ, objects stored in a directory bucket.
- Handles hundreds of thousands of requests per second with single digit millisecond latency.
- Up to 10x faster than Standard, with 50% lower request costs.
- Durability 11 nines, availability 99.95%.
- Use case: latency sensitive apps (AI/ML training, analytics, HPC).
Lifecycle rules
- Transition actions: move objects to another storage class automatically, e.g. to Standard-IA after 60 days, to Glacier after 6 months.
- Expiration actions: delete objects after some time, delete old versions, delete incomplete multipart uploads.
- Rules can target a prefix (e.g.
s3://mybucket/mp3/*) or object tags.
Storage Class Analysis (S3 Analytics)
- Helps you decide when to transition objects to the right class.
- Recommendations for Standard and Standard-IA. Does not work for One Zone-IA or Glacier.
- Takes 24 to 48 hours before you start seeing the analysis.
Cheapest storage for data kept 7 years, rarely read, 48 h retrieval OK?
Glacier Deep Archive.Backups you can easily recreate, lowest cost with fast access?
One Zone-IA.Unpredictable access, no retrieval fees wanted?
Intelligent-Tiering.Archive read once a quarter but needed in milliseconds?
Glacier Instant Retrieval.Clean up abandoned multipart uploads?
Lifecycle expiration rule.Check yourself
- Which S3 class is cheapest for archives you can wait 48 hours to retrieve?
- Which S3 class stores data in a single AZ, so data is lost if that AZ is destroyed?
- Access patterns are unknown and you don't want retrieval fees. Which class?
- Archive data is read about once a quarter but must come back in milliseconds. Which class?
- What is the durability of S3 storage classes?
- What is the minimum storage duration for Glacier Flexible Retrieval?
- How do you automatically clean up abandoned multipart uploads?
- Which class uses directory buckets in a single AZ, for single digit millisecond latency?
- Storage Class Analysis gives transition recommendations for which classes?
- In Intelligent-Tiering, where do objects not accessed for 30 days move automatically?
Chapter 13: S3 events, performance, Batch Operations and Storage Lens
Reacting to S3 events, getting more speed, acting on millions of objects, and seeing your storage at a glance.
Event notifications
- Events: object created, removed, restored, replicated...
- Can be sent to SNS, SQS or Lambda.
- Those targets must allow S3 to send to them, using resource access policies on the SNS topic, SQS queue or Lambda function, not IAM roles.
With Amazon EventBridge
- All S3 events can go to EventBridge, then rules route them to 18+ AWS services as destinations.
- More granularity and control: advanced filtering, multiple destinations, archive and replay.
Performance
- S3 scales automatically to high request rates, latency 100 to 200 ms.
- Per prefix, per second: 3,500 PUT/COPY/POST/DELETE and 5,500 GET/HEAD.
- No limit on the number of prefixes, so spread reads across prefixes to scale.
Faster uploads
- Multipart upload: recommended above 100 MB, required above 5 GB. Parts upload in parallel.
- Transfer Acceleration: upload to an AWS edge location, which forwards the data to the target region over the AWS network.
Faster downloads: byte-range fetches
- Parallelise GETs by requesting specific byte ranges.
- Better resilience in case of failure (retry just one range).
- Also lets you read just part of a file, e.g. its header.
S3 Batch Operations
One request to act on many existing objects:
- Modify object properties and metadata
- Copy objects between buckets
- Encrypt unencrypted objects
- Modify ACLs and tags
- Restore objects from Glacier
- Invoke a Lambda function on each object
A job = list of objects + action + optional parameters. S3 manages retries, tracks progress, sends completion notifications and generates reports.
Build the object list with S3 Inventory, then filter it with Athena.
S3 Storage Lens
- Understand, analyse and optimise storage across an organisation, accounts, regions, buckets or prefixes.
- Dashboards and reports (a default dashboard, or your own).
| Metric group | Examples and use |
|---|---|
| Summary | Bytes used, object count. Find fast growing or unused buckets |
| Cost optimisation | Incomplete multipart uploads older than 7 days, objects that could move to a cheaper class |
| Data protection | Versioning enabled, MFA Delete enabled, SSE-KMS enabled, cross region replication rule counts |
| Access management | Object Ownership (bucket owner enforced) count |
| Event | Buckets with event notifications enabled |
| Performance | Buckets with Transfer Acceleration enabled |
| Activity | Request counts (GET, PUT, LIST...), bytes downloaded |
| Detailed status codes | HTTP status code counts (200, 403...) |
Free vs paid
- Free: 28 usage metrics, data kept 14 days.
- Paid (advanced): extra metrics, CloudWatch publishing, prefix aggregation, data kept 15 months.
Trigger a Lambda when an image lands in S3?
S3 event notification to Lambda, with a resource policy on the function.Send S3 events to many services with filtering?
EventBridge.Users far from the bucket region upload slowly?
S3 Transfer Acceleration.Encrypt millions of existing unencrypted objects?
S3 Batch Operations (list from S3 Inventory).How many GET/s with 4 prefixes?
4 x 5,500 = 22,000.Check yourself
- How many GET requests per second can S3 handle per prefix?
- Users far from your bucket's region complain uploads are slow. What helps?
- You need to encrypt millions of existing unencrypted S3 objects. Best tool?
- An S3 event notification must trigger a Lambda function. How does S3 get permission to invoke it?
- You want S3 events sent to many services with advanced filtering, archive and replay. What do you use?
- Your app spreads reads across 4 prefixes. How many GET requests per second can it reach?
- You want to parallelise downloads and read only the header of large files. Which technique?
- How do you build the object list for an S3 Batch Operations job?
- How long does the free tier of S3 Storage Lens keep metrics?
- Multipart upload is recommended for files above 100 MB.
Chapter 14: S3 encryption and security features
Encrypting objects, forcing HTTPS, locking data (WORM), sharing safely, and access points.
Encryption at rest
| Method | Keys | Upload header | Notes |
|---|---|---|---|
| SSE-S3 | Handled and owned by AWS | "x-amz-server-side-encryption": "AES256" | Default. AES-256 |
| SSE-KMS | AWS KMS keys | "x-amz-server-side-encryption": "aws:kms" | User control, audit key usage with CloudTrail |
| SSE-C | Customer provided, managed outside AWS | Your key in the headers of every request | HTTPS required. S3 never stores your key |
| Client side | Handled by the client | None | Client encrypts before upload and decrypts after download |
Encryption in transit
- SSL/TLS: use the HTTPS endpoint.
- To enforce it, attach a bucket policy that denies requests where
aws:SecureTransportisfalse.
"Condition": { "Bool": { "aws:SecureTransport": "false" } }Default encryption vs bucket policies
- Default encryption (SSE-S3) is applied automatically to new objects.
- A bucket policy can force a specific encryption: refuse any PUT without the right encryption header.
- Bucket policies are evaluated before default encryption.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Action": "s3:PutObject",
"Principal": "*",
"Resource": "arn:aws:s3:::my-bucket/*",
"Condition": {
"StringNotEquals": {
"s3:x-amz-server-side-encryption": "aws:kms"
}
}
}]
}MFA Delete
- Forces users to generate an MFA code before destructive operations: permanently deleting an object version or suspending versioning.
- Versioning must be enabled.
- Only the bucket owner (root account) can enable or disable it.
Access logs
- Log every request to a bucket into another bucket (same region).
Pre-signed URLs
- A URL that carries the credentials of the user who generated it.
- Gives a user temporary access to a private object, for a GET or a PUT.
- Expiry: S3 console 1 min to 720 min (12 h). AWS CLI up to 604,800 s (168 h), default 3,600 s.
- Examples: let logged in users download a premium video, let a user upload a file to a precise location.
WORM: Glacier Vault Lock and Object Lock
WORM = Write Once Read Many.
Glacier Vault Lock
- Create a Vault Lock policy, then lock it for future edits. It can no longer be changed or deleted.
- For compliance and data retention.
S3 Object Lock (versioning required)
- Blocks deletion of an object version for a specified amount of time.
| Retention mode | Who can change it |
|---|---|
| Compliance | Nobody, not even root. Mode can't change, period can't be shortened |
| Governance | Most users can't, but admins with special IAM permissions can change settings or delete |
- Retention period: protects the object for a fixed period, can be extended.
- Legal hold: protects the object indefinitely, independent of the retention period. Users with the
s3:PutObjectLegalHoldIAM permission can add or remove it.
S3 Access Points
Make access management simpler: instead of one huge bucket policy, define access points, each with its own policy and read/write rights.
- Each access point has its own DNS name.
- Origin can be internet or VPC (private access only from within the VPC).
- For VPC origin you must create a VPC endpoint. Its endpoint policy must allow access to the access point and the bucket.
S3 Object Lambda
- Use a Lambda function to modify an object on the fly before the caller receives it.
- Only one bucket needed, with an S3 access point and an S3 Object Lambda access point on top.
- Use cases: redact personal data, convert formats (XML to JSON), resize or watermark images per caller.
Need to audit who used the encryption key?
SSE-KMS, key usage logged in CloudTrail.Keys must stay outside AWS, S3 does the encryption?
SSE-C, over HTTPS only.Reject any request not using HTTPS?
Bucket policy deny when aws:SecureTransport is false.Data must never be deleted for 7 years, not even by root?
Object Lock in Compliance mode.Give a customer 1 hour to download a private file?
Pre-signed URL.Hide personal data from analytics readers without copying the bucket?
S3 Object Lambda.Check yourself
- Which encryption lets you audit key usage in CloudTrail?
- Which option requires HTTPS and sending your key with every request?
- Records must be undeletable for 7 years, even by the root user. What do you use?
- How do you reject any request to a bucket that doesn't use HTTPS?
- What is the risk of SSE-KMS on a bucket with very high request rates?
- Who can enable or disable MFA Delete on a bucket?
- A customer needs 1 hour to download one private file. What do you give them?
- You should store S3 access logs in the same bucket you are monitoring.
- Analysts must read data with personal details redacted, without copying the bucket. What do you use?
- What does an Object Lock legal hold do?
Chapter 15: CloudFront and Global Accelerator
Two ways to use AWS's global edge network: caching content near users, or routing traffic fast to your app.
CloudFront
- CDN (Content Delivery Network): caches content at edge locations all around the world.
- Improves read performance, and gives DDoS protection (integrated with Shield and WAF).
Origins
- S3 bucket: distribute and cache files at the edge. Secured with Origin Access Control (OAC) plus an S3 bucket policy.
- VPC origin: deliver content from apps in private subnets (ALB, NLB, EC2).
- Custom origin (HTTP): S3 static website, or any public HTTP backend.
Connecting CloudFront to an ALB or EC2
- Use a VPC origin: traffic goes to private subnets, no need to expose them to the internet.
Geo restriction
- Allowlist: only the listed countries can access.
- Blocklist: the listed countries are blocked.
CloudFront vs S3 Cross Region Replication
| CloudFront | S3 CRR | |
|---|---|---|
| Network | Global edge network | Must be set up for each region |
| Freshness | Files cached for a TTL (maybe a day) | Updated in near real time |
| Access | Read | Read only replicas |
| Great for | Static content available everywhere | Dynamic content needed at low latency in a few regions |
Pricing and price classes
- Price per GB of data out varies by edge location region (cheaper in the US, Mexico and Canada than in the Middle East, for example).
| Price class | Edge locations |
|---|---|
| Price Class All | All regions, best performance |
| Price Class 200 | Most regions, excludes the most expensive ones |
| Price Class 100 | Only the least expensive regions |
Cache invalidation
- Edges refresh content only once the TTL has expired.
- You can force a full or partial refresh with an invalidation, filtering paths:
/*for everything or/images/*.
AWS Global Accelerator
Problem: your app is in one region, users far away suffer lots of latency from hopping across the public internet.
- Unicast IP: one server holds one IP.
- Anycast IP: all servers share the same IP, and the client is routed to the nearest one.
- Global Accelerator uses anycast IPs on the AWS global network: your app gets 2 anycast IPs, and traffic enters AWS at the edge location closest to the user.
- Endpoints: Elastic IP, EC2, ALB, NLB, public or private.
- Health checks with fast failover (under 1 minute).
- No client cache issue: the IPs never change.
- Security: only 2 IPs to whitelist, DDoS protection with AWS Shield.
CloudFront vs Global Accelerator
Both use the AWS global network and edge locations, and both integrate with Shield for DDoS protection.
| CloudFront | Global Accelerator | |
|---|---|---|
| What it does | Caches content, which is served at the edge | Proxies packets at the edge to apps running in one or more regions. No caching |
| Content | Cacheable (images, videos) and dynamic (APIs, dynamic sites) | Any TCP or UDP application |
| Best for | HTTP content delivery | Non-HTTP uses: gaming (UDP), IoT (MQTT), voice over IP. HTTP apps needing static IPs or fast deterministic regional failover |
Only CloudFront may read the S3 bucket?
Origin Access Control plus a bucket policy.Cut CloudFront cost, accept slower access in some regions?
Price Class 100 or 200.Users still see an old image after an update?
Create a cache invalidation, e.g. /images/*.UDP game servers worldwide with 2 fixed IPs?
Global Accelerator.Block users from one country?
CloudFront geo restriction blocklist.Check yourself
- Gaming servers on UDP need 2 fixed global IPs and fast regional failover. Which service?
- How do you restrict an S3 bucket so it can only be read through CloudFront?
- Users still see an old image after you updated it at the origin. What do you do?
- You want to cut CloudFront cost by using only the least expensive edge regions. Which setting?
- How do you block users from one country on CloudFront?
- Dynamic content must be available at low latency in a few regions, updated in near real time. Best fit?
- How many anycast IPs does Global Accelerator give your app?
- Global Accelerator caches content at edge locations.
- How do you serve content through CloudFront from an ALB in private subnets without exposing it to the internet?
- What do CloudFront and Global Accelerator have in common?
Chapter 16: Snowball, FSx and Storage Gateway
Moving data physically, third party file systems on AWS, and hybrid cloud storage.
Snowball
- Highly secure, portable device to collect and process data at the edge, and to migrate data into and out of AWS.
| Device | Specs |
|---|---|
| Snowball Edge Storage Optimized | 104 vCPU, 416 GB RAM, 210 TB storage |
| Snowball Edge Compute Optimized | 104 vCPU, 416 GB RAM, 28 TB storage |
- Can run EC2 instances and Lambda functions on the device (edge computing).
- Example: you need compute in a remote location (a boat, a mine...) to process data, then ship the device back to AWS for integration.
Architecture: Snowball into Glacier
Amazon FSx
Launch third party high performance file systems on AWS, as a fully managed service. Four flavours: Lustre, Windows File Server, NetApp ONTAP, OpenZFS.
FSx for Windows File Server
- SMB protocol and Windows NTFS.
- Active Directory integration, ACLs, user quotas.
- Can also be mounted on Linux EC2 instances.
- Supports Microsoft DFS (Distributed File System) namespaces, to group files across on-prem and cloud file systems.
- Storage: SSD or HDD. Can be Multi-AZ.
- Can be accessed from on-prem. Backed up daily to S3.
FSx for Lustre (Linux + cluster)
- Parallel distributed file system for large scale computing.
- Use cases: HPC, machine learning, video processing, financial modelling.
- Scales to hundreds of GB/s, millions of IOPS, sub-millisecond latency.
- Storage: SSD for low latency, IOPS intensive workloads. HDD for throughput intensive workloads.
- Seamless integration with S3: read S3 as a file system, write results back to S3.
- Can be accessed from on-prem.
| Lustre deployment | Scratch | Persistent |
|---|---|---|
| Storage | Temporary | Long term |
| Replication | None | Replicated within the same AZ, failed files replaced in minutes |
| Performance | High burst (200 MB/s per TiB) | Consistent |
| Usage | Short term processing, lower cost | Long term processing, sensitive data |
FSx for NetApp ONTAP
- Managed NetApp ONTAP on AWS. Compatible with NFS, SMB and iSCSI.
- Move workloads running on ONTAP or NAS to AWS.
- Storage shrinks or grows automatically. Snapshots, replication, low cost.
- Point in time instant cloning (handy for testing new workloads).
FSx for OpenZFS
- Compatible only with NFS.
- Move ZFS workloads to AWS. High performance, up to 1M IOPS.
- Point in time instant cloning.
Hybrid cloud: AWS Storage Gateway
Cloud native storage options:
EBS, EC2 instance store
EFS, FSx
S3, Glacier
- Storage Gateway is a bridge between on-prem data and cloud data.
- Use cases: disaster recovery, backup and restore, tiered storage, on-prem cache and low latency file access.
- 3 types: S3 File Gateway, Volume Gateway, Tape Gateway.
S3 File Gateway
- Files are stored as S3 objects. Most recently used data is cached on the gateway.
- Works with S3 storage classes except Glacier. Use a lifecycle policy to move objects to Glacier.
Volume Gateway
- Goal: back up your on-prem volumes in AWS.
- Cached volumes: low latency access to the most recent data.
- Stored volumes: the entire dataset stays on-prem, with scheduled backups to S3.
Tape Gateway
- A virtual tape library for existing tape based backup software, backed by S3 and Glacier.
Move 200 TB into Glacier with a Snowball?
Import to S3, then a lifecycle policy to Glacier.Windows file share with Active Directory on AWS?
FSx for Windows File Server.HPC job reading training data from S3 at high speed?
FSx for Lustre (scratch for short jobs, persistent for long term).Need NFS, SMB and iSCSI from one managed file system?
FSx for NetApp ONTAP.On-prem servers need to read and write files that live in S3?
S3 File Gateway.Keep all data on-prem but back it up to AWS?
Volume Gateway, stored volumes.Check yourself
- You must load 200 TB into Glacier using a Snowball device. How?
- Which FSx option is built for HPC and ML and integrates seamlessly with S3?
- On-prem servers need NFS access to files stored as objects in S3, with a local cache. Which service?
- You need a Windows file share with Active Directory integration on AWS. Which service?
- One managed file system must serve NFS, SMB and iSCSI. Which service?
- You want to keep the full dataset on-prem but back it up to AWS. Which option?
- FSx for Windows File Server can also be mounted on Linux EC2 instances.
- Which FSx for Lustre deployment suits short term processing at the lowest cost?
- Your existing tape based backup software must back up to the cloud. Which service?
- You need to process data on a ship with no reliable connection, then send it to AWS. What fits?
Chapter 17: DataSync, Transfer Family and choosing a storage service
Moving files into AWS over the network, letting partners upload by FTP, and the big storage comparison table the exam loves.
AWS DataSync
DataSync moves large amounts of data to and from AWS, and keeps it in sync on a schedule.
- On-prem or other cloud to AWS: needs a DataSync agent (a VM) that reads NFS, SMB, HDFS or S3 API storage.
- AWS to AWS (S3, EFS, FSx to each other): no agent needed.
- Destinations: S3 (any storage class, including Glacier), EFS, FSx (all flavours).
- Runs on a schedule: hourly, daily, weekly. Not continuous.
- Keeps file permissions and metadata (NFS POSIX, SMB ACLs). Storage Gateway and Snowball don't do this as well.
- One agent task can use up to 10 Gbps; you can set a bandwidth limit.
- No network? The agent can run on a Snowcone device you ship back.
AWS Transfer Family
- Fully managed FTP, FTPS and SFTP service that writes into S3 or EFS.
- Use case: partners or legacy apps that only know FTP need to send you files.
- Scalable, Multi-AZ. Pay per endpoint per hour plus data transferred.
- Users: managed by the service, or your own identity source (Active Directory, LDAP, Okta, Cognito, custom).
- Reach it through a public endpoint, or a VPC endpoint (private, can use Elastic IPs and security groups).
Storage comparison (exam favourite)
| Service | What it is | Pick it when |
|---|---|---|
| S3 | Object storage | Any files, static sites, data lakes, backups |
| S3 Glacier | Archive object storage | Long term archives, cheap, slow retrieval |
| EBS | Network block storage, one AZ | Disk for one EC2 instance (multi-attach only io1/io2) |
| Instance store | Physical disk on the host | Max IOPS, temporary data |
| EFS | NFS for Linux, Multi-AZ | Shared file system for many Linux instances |
| FSx for Windows | SMB, NTFS, AD | Windows file shares |
| FSx for Lustre | Parallel HPC file system | HPC, ML, linked to S3 |
| FSx for NetApp ONTAP | NFS, SMB, iSCSI | Moving NetApp / NAS workloads |
| FSx for OpenZFS | NFS only | Moving ZFS workloads |
| Storage Gateway | Hybrid bridge | On-prem apps using S3 / EBS snapshots / tapes |
| Transfer Family | FTP, FTPS, SFTP front end | Partners upload by FTP into S3 / EFS |
| DataSync | Scheduled sync | Migrate or sync file data, keep metadata |
| Snow Family | Physical device | Huge data, slow or no network, edge compute |
| Databases | Indexed, queryable | Data you need to search and query |
Sync on-prem NFS to EFS every night, keeping permissions?
DataSync with an agent on-prem.Copy data from EFS to S3 once a day?
DataSync, no agent needed between AWS services.Partners must keep using SFTP, but you want the files in S3?
AWS Transfer Family.DataSync vs Storage Gateway?
DataSync migrates or syncs on a schedule. Storage Gateway gives on-prem apps ongoing, cached access to cloud storage.Check yourself
- You must sync an on-prem NFS share to Amazon EFS every night and keep file permissions. Which service?
- DataSync needs an agent to copy data between two AWS storage services, such as EFS to S3.
- DataSync can write directly into Glacier storage classes.
- Partners can only send files by SFTP, but you want them stored in S3. Which service?
- Where can AWS Transfer Family store uploaded files?
- What is the main difference between DataSync and Storage Gateway?
- Many Linux EC2 instances in several AZ need one shared file system. Which service?
- A site has 500 TB to move and only a slow internet link. What is the best fit?
- Which identity sources can AWS Transfer Family use for user logins?
- Which storage service gives block storage for a single EC2 instance, locked to one AZ?
Chapter 18: Decoupling with SQS, SNS, Kinesis and Amazon MQ
Decoupling means putting a buffer between parts of an app, so one part can slow down, fail or scale without breaking the others.
SQS
SNS
Kinesis
Amazon MQ
SQS, Simple Queue Service
Standard queue
- Oldest AWS service. Fully managed, unlimited throughput and unlimited messages in the queue.
- Retention: 4 days by default, 14 days max. Latency under 10 ms.
- Max message size: 1 MiB (older material says 256 KB). Bigger payloads: store in S3, send a pointer.
- At least once delivery (duplicates possible) and best effort ordering (out of order possible).
- Consumers poll up to 10 messages at a time, process them, then delete them.
- Scale consumers with an ASG driven by the CloudWatch metric ApproximateNumberOfMessages.
- Security: HTTPS in flight, KMS at rest, IAM, and SQS access policies (like bucket policies) for cross-account access or to let S3 / SNS write to the queue.
Key settings
| Setting | What it does |
|---|---|
| Visibility timeout | Once polled, a message is hidden from other consumers for 30 s by default. Not deleted in time: it reappears. Consumer can call ChangeMessageVisibility for more time. |
| Long polling | Consumer waits 1 to 20 s for messages to arrive. Fewer API calls, lower latency and cost. Preferred over short polling. |
| Dead letter queue | After MaximumReceives failures, the message goes to a DLQ for debugging. Then redrive it back to the source queue. |
| Delay queue | Hide new messages for 0 to 15 min before consumers see them. |
FIFO queue
- Ordered and exactly once processing (deduplication). Name must end in
.fifo. - Limited throughput: 300 msg/s, 3,000 msg/s with batching (high throughput mode goes higher).
- Ordering per Message Group ID: one consumer per group, so more groups means more parallelism.
- The DLQ of a FIFO queue must also be FIFO.
Classic exam pattern: SQS as a buffer in front of a database so no write is lost during a traffic spike.
SNS, Simple Notification Service
- Publish once, many subscribers receive it (pub/sub).
- Up to 12,500,000 subscriptions per topic, 100,000 topics per account.
- Subscribers: SQS, Lambda, Kinesis Data Firehose, HTTP(S), email, SMS, mobile push.
- Many AWS services publish to SNS: CloudWatch alarms, ASG notifications, S3 events, CloudFormation...
- Security like SQS: HTTPS, KMS, IAM, SNS access policies.
- Message filtering: a JSON filter policy per subscription, so each subscriber only gets matching messages.
- FIFO topics: ordering and dedup, subscribers can be SQS FIFO or SQS standard.
Fan-out pattern: SNS + SQS
- Fully decoupled, no data loss (queues persist), add subscribers any time.
- The queue access policy must allow SNS to write.
- Use case: one S3 event rule (event type + prefix) can only have one destination, so send it to SNS and fan out to many queues.
- Works cross-region too.
Kinesis
Kinesis Data Streams (KDS)
- Collect and store real time streaming data: clickstreams, IoT, logs, metrics.
- Retention up to 365 days, so data can be replayed. Data can't be deleted until it expires.
- Records up to 1 MB. Ordering per partition key (same key goes to same shard).
- Capacity: provisioned (each shard: 1 MB/s or 1,000 records/s in, 2 MB/s out) or on-demand (scales automatically).
- Consumers: Lambda, KCL apps, Firehose, Managed Service for Apache Flink.
Amazon Data Firehose (Kinesis Data Firehose)
- Fully managed, serverless, loads streaming data into destinations: S3, Redshift (via S3 COPY), OpenSearch, Splunk, any HTTP endpoint, partners like Datadog.
- Near real time because it buffers (by size or time).
- Can transform with Lambda, convert to Parquet / ORC, compress. Failed data goes to a backup S3 bucket.
- No storage, no replay.
| Data Streams | Firehose | |
|---|---|---|
| Purpose | Store and process streams | Deliver streams to a destination |
| Management | You write producers and consumers | Fully managed |
| Latency | Real time | Near real time |
| Storage / replay | Up to 365 days, replay yes | None |
Ordering: SQS FIFO vs Kinesis
100 trucks send GPS data, order needed per truck:
- Kinesis: partition key = truck ID. Parallelism = number of shards (5 shards, 5 consumers).
- SQS FIFO: Message Group ID = truck ID. Parallelism = number of groups (up to 100 consumers), no shards to manage.
Amazon MQ
- Managed RabbitMQ and ActiveMQ.
- For apps using open protocols: MQTT, AMQP, STOMP, OpenWire, WSS. Migrate on-prem messaging without rewriting the app to SQS / SNS.
- Runs on servers, doesn't scale like SQS / SNS. Has both queues and topics.
- High availability: Multi-AZ with active / standby failover (ActiveMQ uses EFS as shared storage).
Messages are processed twice. What to check?
Visibility timeout too short; raise it or call ChangeMessageVisibility.Reduce empty receives and API cost on SQS?
Long polling (WaitTimeSeconds 1 to 20).Strict order and no duplicates?
SQS FIFO.One event must go to several independent processing apps?
SNS + SQS fan-out.Real time stream that must be replayed later?
Kinesis Data Streams.Load streaming data into S3 or Redshift with no code?
Amazon Data Firehose.Migrate an app that uses AMQP or MQTT?
Amazon MQ.Check yourself
- A message is processed twice by different consumers of a standard SQS queue. What is the most likely cause?
- What is the default and maximum message retention of an SQS queue?
- How do you reduce the number of empty responses and API calls when consumers poll SQS?
- What is the throughput of an SQS FIFO queue with batching (standard mode)?
- One S3 upload event must be processed by three independent applications. Which pattern?
- Streaming data must be stored for 30 days and replayed by new consumers. Which service?
- You want to load streaming data into S3 as Parquet with no code to manage. Which service?
- An on-prem app uses AMQP and MQTT. You want to move it to AWS without rewriting it. Which service?
- With SQS FIFO, how do you keep ordering per customer while processing different customers in parallel?
- Amazon Data Firehose delivers data in real time with no buffering.
Chapter 19: Containers on AWS: ECS, Fargate, ECR, EKS and App Runner
A container (Docker) packages an app with everything it needs, so it runs the same everywhere. AWS gives you several ways to run them.
AWS's own orchestrator
Managed Kubernetes
Serverless compute for both
Image registry
Amazon ECS, Elastic Container Service
You launch ECS tasks (running containers) on an ECS cluster. Two launch types:
| EC2 launch type | Fargate launch type | |
|---|---|---|
| Servers | You provision and maintain EC2 instances (each runs the ECS agent) | Serverless, no instances to manage |
| You define | Task definitions + instance capacity | Task definitions with CPU and RAM |
| Scaling | Scale tasks and instances | Just increase the number of tasks |
IAM roles
- EC2 instance profile (EC2 launch type only): used by the ECS agent to call ECS, send logs to CloudWatch, pull images from ECR, read secrets.
- ECS task role: gives each task its own permissions (task A reads S3, task B writes DynamoDB). Defined in the task definition.
Load balancing and storage
- ALB for most cases, NLB for very high throughput or with PrivateLink.
- Persistent shared storage: EFS mounted into tasks, works with EC2 and Fargate. Fargate + EFS = fully serverless.
- S3 cannot be mounted as a file system in a task.
Auto scaling
- ECS Service Auto Scaling (via Application Auto Scaling): target tracking on CPU, memory or ALB request count per target, step scaling, scheduled scaling.
- EC2 launch type also needs more instances: use an ASG, or better an ECS Cluster Capacity Provider that adds instances when tasks lack room.
Common patterns
Amazon ECR, Elastic Container Registry
- Store and manage Docker images on AWS, private or public (ECR Public Gallery).
- Integrated with ECS and EKS, images stored on S3 behind the scenes.
- Access controlled by IAM (permission errors = check the policy).
- Image vulnerability scanning, versioning, tags, lifecycle policies.
Amazon EKS, Elastic Kubernetes Service
- Managed Kubernetes (open source, cloud agnostic). Choose it when a company already uses Kubernetes or wants to move between clouds.
- Node types:
- Managed node groups: AWS creates and manages EC2 nodes in an ASG (on-demand or spot).
- Self-managed nodes: you build and manage them yourself.
- Fargate: no nodes at all.
- Storage: a StorageClass with a CSI driver: EBS, EFS (the one that works with Fargate), FSx for Lustre, FSx for NetApp ONTAP.
AWS App Runner
- Fully managed: deploy a web app or API from source code or a container image, no infrastructure knowledge needed.
- Builds, deploys, auto scales, gives you HTTPS, load balancing, encryption, VPC access.
- Use case: get a web app or microservice live fast.
Run containers without managing servers?
ECS or EKS with Fargate.Each container needs different AWS permissions?
ECS task roles, one per task definition.Shared persistent storage for Fargate tasks?
EFS.Company already runs Kubernetes on-prem?
EKS.Scale the EC2 instances behind ECS automatically?
ECS Cluster Capacity Provider.Simplest way to deploy a containerised web app?
App Runner.Check yourself
- You want to run containers on AWS without provisioning or managing any EC2 instances. Which option?
- Two ECS tasks need different AWS permissions (one reads S3, one writes DynamoDB). What do you use?
- Fargate tasks need a shared persistent file system. Which storage?
- Which component automatically adds EC2 instances to an ECS cluster when tasks lack capacity?
- Your company already runs Kubernetes on-prem and wants the same tooling on AWS. Which service?
- Which metrics can ECS Service Auto Scaling track?
- Where do you store private Docker images on AWS?
- Which EKS node type is fully managed by AWS as EC2 instances in an Auto Scaling Group?
- You want to deploy a containerised web app from source code with no infrastructure knowledge. Which service?
- How do you run an ECS task each time a file is uploaded to S3?
Chapter 20: Serverless part 1: AWS Lambda and DynamoDB
Serverless means you don't manage servers: you deploy code or data and AWS handles capacity, scaling and patching. Lambda runs the code, DynamoDB stores the data.
AWS Lambda
- Run functions on demand, triggered by events. Scales automatically. Pay per request and per compute time (GB-seconds).
- Free tier: 1M requests and 400,000 GB-s per month.
- Runtimes: Node.js, Python, Java, .NET, Ruby, custom runtime. Also container images (must implement the Lambda Runtime API).
- More RAM also gives more CPU and network.
- Triggers: API Gateway, S3, DynamoDB Streams, SQS, SNS, Kinesis, EventBridge, Cognito, CloudFront...
Limits to know (per region)
| Limit | Value |
|---|---|
| Memory | 128 MB to 10 GB |
| Max execution time | 15 minutes (longer: use ECS, Fargate, Batch) |
| Environment variables | 4 KB |
| /tmp disk | 512 MB to 10 GB |
| Concurrency | 1,000 executions (can be raised) |
| Deployment package | 50 MB zipped, 250 MB unzipped; container image up to 10 GB |
Concurrency and cold starts
- Reserved concurrency: cap a function so it can't eat all 1,000 and throttle other functions.
- Throttled: synchronous calls get a 429 error; async calls retry, then go to a DLQ.
- Cold start: a new instance loads code and runs init, so the first request is slow.
- Fix: provisioned concurrency (instances kept warm) or SnapStart (Java, Python, .NET: snapshot of the initialised function).
Lambda in a VPC
- By default Lambda runs outside your VPC. Attach it to your VPC (subnets + security group) to reach RDS, ElastiCache, internal ALB: Lambda creates an ENI.
- Internet from a VPC Lambda needs a NAT Gateway (public subnet doesn't help).
- Many Lambdas opening DB connections: use RDS Proxy (Lambda must be in the VPC).
- RDS for PostgreSQL and Aurora MySQL can invoke Lambda from inside the database (e.g. on insert).
Edge functions: CloudFront Functions vs Lambda@Edge
| CloudFront Functions | Lambda@Edge | |
|---|---|---|
| Language | JavaScript | Node.js, Python |
| Scale | Millions of requests/s | Thousands of requests/s |
| Triggers | Viewer request / response only | Viewer + origin request / response |
| Max time | Under 1 ms | 5 s (viewer) / 30 s (origin) |
| Network / body access | No | Yes |
| Use for | Header changes, URL rewrites, cache keys, JWT checks | Longer logic, 3rd party libraries, calling other services |
Amazon DynamoDB
- Fully managed, serverless NoSQL database, replicated across 3 AZ. Millions of requests per second, single digit millisecond latency.
- Made of tables. Each item has a primary key: partition key alone, or partition key + sort key.
- Max item size 400 KB. Flexible schema: add attributes any time.
- IAM for security, no SQL joins.
Capacity modes
| Mode | How | Pick when |
|---|---|---|
| Provisioned (default) | Set RCU / WCU, optional auto scaling | Predictable traffic, cheaper |
| On-demand | Pay per request, scales instantly | Unpredictable or spiky traffic |
Features
- DAX: in-memory cache for DynamoDB, microsecond reads, no app changes. (ElastiCache is better to cache aggregated computed results.)
- DynamoDB Streams: ordered stream of item changes, 24 h retention, processed by Lambda. Or send changes to Kinesis Data Streams for up to 1 year retention.
- Global tables: multi-region, active-active (read and write in any region). Needs Streams enabled.
- TTL: items expire and are deleted automatically (sessions, old data).
- Backups: point in time recovery up to 35 days, on-demand backups, or AWS Backup (cross-region).
- Export to S3 (needs PITR, no read capacity used) and import from S3.
- Table classes: Standard, or Standard-IA for rarely accessed data.
Job runs 40 minutes. Lambda?
No, 15 min max. Use ECS / Fargate or AWS Batch.First request after idle is slow on Lambda?
Cold start: provisioned concurrency or SnapStart.VPC Lambda can't reach the internet?
Route through a NAT Gateway.Lambda floods RDS with connections?
RDS Proxy.Simple header rewrite at the edge for millions of requests?
CloudFront Functions.DynamoDB reads need microsecond latency?
DAX.Users in several regions must write to the same table?
DynamoDB global tables.Spiky, unpredictable traffic on a new table?
On-demand capacity mode.Check yourself
- What is the maximum execution time of a Lambda function?
- Users complain the first request after a quiet period is slow on your Java Lambda. What helps?
- A Lambda function attached to your VPC must call a public internet API. What does it need?
- How do you stop one Lambda function from using all the account's concurrency?
- You need to rewrite headers at the edge for millions of requests per second, in under a millisecond. Which option?
- What is the maximum size of a DynamoDB item?
- DynamoDB reads must have microsecond latency without changing application logic. What do you add?
- Users in Europe and Asia must both write to the same DynamoDB table with low latency. Which feature?
- A new app has unpredictable, spiky traffic. Which DynamoDB capacity mode fits best?
- How long can DynamoDB point in time recovery restore back to?
Chapter 21: Serverless part 2: API Gateway, Step Functions, Cognito and serverless architectures
API Gateway puts a front door on your functions, Step Functions chains them into workflows, Cognito handles your users. Together with Lambda and DynamoDB they make a full serverless app.
Amazon API Gateway
- Serverless way to create REST and WebSocket APIs. Lambda + API Gateway = no infrastructure at all.
- Handles versioning and stages (dev, test, prod), API keys, request throttling, caching of responses, request validation and transformation, import from Swagger / OpenAPI.
- Integrations: Lambda, any HTTP backend (on-prem, ALB), or an AWS service directly (start a Step Functions run, send to SQS, put a record in Kinesis).
- Default integration timeout: 29 seconds.
Endpoint types
| Type | Meaning |
|---|---|
| Edge-optimized (default) | Requests routed through CloudFront edge locations; API still lives in one region. For global clients. |
| Regional | Clients in the same region (you can add your own CloudFront in front). |
| Private | Only reachable from your VPC through an interface VPC endpoint, controlled by a resource policy. |
Security
- Authentication: IAM roles (internal apps), Cognito user pools (your app's users), or a Lambda authorizer (your own logic, e.g. a 3rd party token).
- Custom domain with HTTPS through ACM: for edge-optimized the certificate must be in us-east-1; for regional, in the API's region.
AWS Step Functions
- Build a visual serverless workflow (a state machine) to orchestrate Lambda functions and other services.
- Features: sequence, parallel steps, conditions, timeouts, error handling and retries, human approval steps.
- Integrates with Lambda, ECS, Batch, DynamoDB, SQS, SNS, EMR, Glue, API Gateway and many more.
- Use case: order processing, data pipelines, any multi-step business process.
Amazon Cognito
Gives users of your web or mobile app an identity (they are not IAM users).
| Cognito User Pools | Cognito Identity Pools | |
|---|---|---|
| Purpose | Sign in for app users | Give users temporary AWS credentials |
| How | Serverless user directory: username or email + password, MFA, password reset, social login (Google, Facebook), SAML / OIDC | Users from a user pool or a 3rd party login get an IAM role |
| Result | A JWT token | Direct access to S3, DynamoDB... with IAM policies |
| Integrates with | API Gateway, ALB | Any AWS service the IAM role allows |
- Identity pools support row level security in DynamoDB: a policy variable on the user's ID so each user only reads their own items.
Serverless architectures to recognise
Mobile app (for example a to-do list)
- API Gateway verifies the user's token with Cognito before calling Lambda.
- Files: the app uses Cognito temporary credentials to read and write files in S3 directly, without going through API Gateway. An IAM policy limits each user to their own files.
- High read throughput: put a DAX cache in front of DynamoDB.
- Static, repeated responses: cache them at the API Gateway level, so Lambda isn't even called.
Serverless website (a blog with static content)
- OAC (Origin Access Control): the S3 bucket policy only allows CloudFront, so nobody can read the bucket directly.
Send a welcome email to new users
- The Lambda function needs an IAM role that allows it to use SES (Simple Email Service).
Picture management (thumbnails)
- Uploads go through CloudFront edge locations, or use S3 Transfer Acceleration, so users far away upload faster.
Microservices
- Each microservice exposes a REST API and has its own code and architecture: each one can be designed the way you want.
- Users find each service through Route 53 (DNS).
| Service | Front door | Compute | Data |
|---|---|---|---|
| Service 1 | Elastic Load Balancing | ECS | DynamoDB |
| Service 2 | API Gateway | Lambda | ElastiCache |
| Service 3 | ELB | EC2 | RDS |
Two communication patterns
API Gateway, load balancers
SQS, Kinesis, SNS, Lambda triggers (S3 events)
Distributing software updates with CloudFront
The problem: an app on EC2 distributes software updates once in a while. When a new version comes out, all clients ask for it at the same time. That huge burst of requests makes the Auto Scaling group scale out a lot, which is costly in CPU and network.
Why CloudFront is the answer
- No change in the architecture: just put CloudFront in front.
- It caches the update files at edge locations around the world.
- Updates are static, not dynamic, so they cache perfectly.
- EC2 is not serverless, but CloudFront is, and scales for you.
- The ASG won't have to scale out much: big savings on EC2, plus on availability and network bandwidth cost.
Serverless REST API in front of Lambda?
API Gateway.API only reachable from inside the VPC?
Private API Gateway endpoint with an interface VPC endpoint.Edge-optimized API with a custom domain: where's the certificate?
ACM in us-east-1.Multi-step workflow with retries and a human approval?
Step Functions.App users sign in, get a JWT?
Cognito User Pools.App users upload directly to S3 with temporary credentials?
Cognito Identity Pools.DynamoDB reads are too heavy?
Add DAX (and cache static responses in API Gateway).S3 bucket must only be readable through CloudFront?
Origin Access Control (OAC) and a bucket policy that only allows CloudFront.Thousands of clients download the same update from EC2 at once?
Put CloudFront in front: static files cached at the edge, the ASG barely scales.Asynchronous links between microservices?
SQS, SNS, Kinesis, Lambda triggers.Check yourself
- Which are API Gateway endpoint types?
- Your API must only be reachable from inside your VPC. Which endpoint type?
- An edge-optimized API Gateway uses a custom domain. Where must the ACM certificate be?
- Which can authenticate requests to API Gateway?
- You need a workflow that chains several Lambda functions with retries, branches and a human approval step. Which service?
- Mobile app users must sign in with email and password, with optional Google login, and receive a JWT. Which service?
- App users must upload photos directly to S3 using temporary AWS credentials. Which service?
- Each user of your app should only read their own items in a DynamoDB table. How?
- What is the default integration timeout of API Gateway?
- You want to send a welcome email when a new user row is inserted in DynamoDB. Which pattern?
- An app on EC2 in an Auto Scaling group distributes software updates. Every release, all clients download at once and the ASG scales out a lot, which is costly. What is the simplest fix with no change to the architecture?
- Your static website lives in S3 behind CloudFront. How do you make sure users can't read the bucket directly?
- Which of these are asynchronous ways for microservices to communicate?
Chapter 22: Data and analytics: Athena, Redshift, OpenSearch, EMR, Glue, QuickSight and MSK
The exam gives you a data need (query logs, build a warehouse, search, dashboards, ETL, streaming) and expects you to pick the right analytics service.
Amazon Athena
- Serverless SQL queries directly on files in S3 (built on Presto / Trino). Pay per TB scanned (about $5 per TB).
- Formats: CSV, JSON, ORC, Avro, Parquet. Commonly used with QuickSight for reporting and dashboards.
- Use cases: analytics, reporting, business intelligence, ad hoc queries, log analysis (VPC Flow Logs, ELB logs, CloudTrail logs).
Make Athena faster and cheaper
- Use columnar formats (Apache Parquet, ORC): huge performance improvement and far less data scanned. Use Glue to convert your data to Parquet or ORC.
- Compress data (gzip, bzip2...).
- Partition datasets in S3 so queries can filter on virtual columns:
s3://yourBucket/pathToTable/columnName=value/columnName=value/, for examples3://bucket/year=2026/month=11/. - Use larger files (128 MB and more): fewer, bigger files are cheaper to scan than many tiny ones.
Federated Query
- Query data outside S3 with SQL: relational, non-relational, object and custom data sources (DynamoDB, RDS, on-prem databases, other clouds).
- Works through data source connectors that run as Lambda functions; results can be stored in S3.
Amazon Redshift
- Database based on PostgreSQL, but not for OLTP (Online Transaction Processing): it is for OLAP (Online Analytical Processing), so it is used for analytics and data warehousing.
- About 10x better performance than other data warehouses, scales to petabytes of data.
- Columnar storage of data plus a parallel query engine, with a SQL interface for queries.
- Two modes: provisioned cluster or Redshift Serverless.
- Vs Athena: faster for complex queries, joins and aggregations, thanks to indexes, but you must load the data in first.
Inside a cluster
plans queries, aggregates results
run the queries, send results to the leader
- Provisioned: you choose the instance types in advance, and can reserve instances for cost savings.
Snapshots and disaster recovery
- Redshift has Multi-AZ mode for some cluster types (RA3); otherwise a cluster lives in one AZ.
- Snapshots are point in time backups stored in S3.
- They are incremental: only what changed since the last snapshot is saved.
- You can restore a snapshot into a new cluster.
- Automated snapshots: every 8 hours, every 5 GB of changes, or on a schedule (with a retention period). Manual snapshots are kept until you delete them.
- Redshift can copy snapshots to another region automatically for DR.
Loading data (ingestion)
- S3 COPY can use enhanced VPC routing so the data stays off the internet.
- From EC2 with JDBC, insert in large batches: row by row is very inefficient.
Redshift Spectrum
- Analyse data in S3 without loading it into Redshift first.
- You need a Redshift cluster to start the query; the query is then submitted to thousands of Spectrum nodes, which read the data in S3. A lot more processing power.
Amazon OpenSearch Service
- Successor of Elasticsearch. Search any field, partial matches, unlike DynamoDB which queries by key.
- Managed cluster or serverless. Ingest from Firehose, IoT, CloudWatch Logs.
- Classic pattern: keep data in DynamoDB, use DynamoDB Streams → Lambda → OpenSearch to make it searchable, then fetch the full item from DynamoDB.
Amazon EMR
- Managed Hadoop clusters (Spark, HBase, Presto, Flink...) on hundreds of EC2 instances for big data.
- Use cases: data processing, ML, web indexing, big data.
- Nodes: master (on-demand or reserved), core (stores data, long running: reserved), task (just compute: spot).
Glue, Lake Formation and QuickSight
AWS Glue
- Serverless ETL (extract, transform, load). Example: S3 upload → Glue job converts CSV to Parquet → Athena queries it.
- Glue Data Catalog: crawlers discover your data and store table definitions, used by Athena, Redshift Spectrum and EMR.
- Job Bookmarks (don't reprocess old data), Glue DataBrew (clean data with no code), Glue Studio (visual jobs), Glue Streaming ETL (from Kinesis or MSK).
AWS Lake Formation
- Build a data lake in days, on top of Glue. Blueprints to ingest from S3, RDS, on-prem.
- Centralised, fine-grained access control (row and column level) for all apps reading the lake.
Amazon QuickSight
- Serverless BI dashboards. SPICE in-memory engine for imported data.
- Sources: RDS, Aurora, Athena, Redshift, S3, OpenSearch, SaaS apps...
- Users and groups are QuickSight users, not IAM. Column level security in Enterprise edition.
Streaming: MSK and Managed Service for Apache Flink
| Kinesis Data Streams | Amazon MSK (managed Kafka) | |
|---|---|---|
| Message size | 1 MB | 1 MB default, configurable higher (e.g. 10 MB) |
| Unit | Shards (split, merge) | Topics with partitions (add only) |
| Retention | Up to 365 days | As long as you want (EBS storage) |
| Encryption | TLS in flight, KMS at rest | Plaintext or TLS in flight, KMS at rest |
- MSK: brokers spread over multiple AZ, or MSK Serverless. Pick it when the team already uses Kafka.
- Managed Service for Apache Flink: real time processing of streams from Kinesis Data Streams or MSK (not Firehose).
Big data ingestion pipeline
Serverless SQL on S3 logs?
Athena (use Parquet + partitions to cut cost).Athena must also query DynamoDB or an on-prem database?
Federated Query with Lambda data source connectors.Complex analytics with joins on loaded data?
Redshift.Which Redshift node plans the query and aggregates results?
The leader node; compute nodes run the query.Query huge data in S3 from Redshift without loading it?
Redshift Spectrum.Load data into Redshift from EC2?
JDBC driver, in large batches (or better: S3 COPY).Full text search across item fields?
OpenSearch.Hadoop / Spark cluster?
EMR.Convert CSV to Parquet serverlessly?
Glue ETL.Row and column level permissions on a data lake?
Lake Formation.Dashboards for business users?
QuickSight.Company already uses Kafka?
Amazon MSK.Check yourself
- You need to run SQL queries on CloudTrail logs stored in S3 without managing servers. Which service?
- Which steps reduce Athena cost and improve performance?
- Athena must also query data in DynamoDB and an on-prem database. Which feature?
- Which service is a columnar data warehouse for OLAP analytics?
- How do you protect a Redshift cluster against a regional disaster?
- In a provisioned Redshift cluster, which node plans the query and aggregates the results?
- You want Redshift to query a huge dataset stored in S3 without loading it into the cluster. What do you use?
- Redshift snapshots are incremental: only what changed since the last snapshot is saved.
- Users must search products by any field with partial matches. Data lives in DynamoDB. What do you add?
- Which EMR node type is best run on spot instances?
- Which service gives row and column level access control across a data lake?
- Your team already runs Apache Kafka and wants a managed version on AWS. Which service?
- Which sources can Managed Service for Apache Flink read from?
Chapter 23: Choosing an AWS database: DocumentDB, Neptune, Keyspaces and Timestream
Many exam questions describe a type of data (transactions with joins, JSON documents, a social graph, sensor readings over time) and expect you to pick the matching AWS database. Learn the database types first, then the specialised NoSQL engines.
Database types and the AWS service for each
| Type | AWS services | Pick it for |
|---|---|---|
| Relational (RDBMS), SQL, OLTP | RDS, Aurora | Transactions, structured data, great for joins |
| NoSQL | DynamoDB (JSON), ElastiCache (key/value), Neptune (graphs), DocumentDB (MongoDB), Keyspaces (Cassandra) | Flexible schema, massive scale. No joins, no SQL |
| Object store | S3, S3 Glacier | Big files, backups, data lakes, archives |
| Data warehouse | Redshift (OLAP), Athena, EMR | SQL analytics and business intelligence (BI) |
| Search | OpenSearch (JSON documents) | Free text and unstructured search |
| Graph | Amazon Neptune | Showing relationships between data |
| Ledger | Amazon Quantum Ledger Database (QLDB) | Immutable, verifiable history of changes |
| Time series | Amazon Timestream | Points with a timestamp and a value (metrics, IoT) |
Amazon DocumentDB
- AWS implementation of MongoDB: a NoSQL database that stores, queries and indexes JSON documents.
- Works like Aurora: fully managed, highly available with data replicated across 3 AZ, storage grows automatically in 10 GB steps.
- Exam keyword: "MongoDB" points to DocumentDB.
Amazon Neptune
- Fully managed graph database.
- For highly connected datasets, for example a social network: users have friends, posts have comments, comments have likes. A graph database makes queries on those relationships fast.
- Other uses: knowledge graphs (like Wikipedia), fraud detection, recommendation engines.
Neptune Streams
- A real time, ordered sequence of every change to your graph data.
- Changes are available immediately after writing, with no duplicates and in strict order.
- Read through an HTTP REST API. Uses: send notifications when data changes, keep a copy in OpenSearch or ElastiCache, replicate to another region.
Amazon Keyspaces (for Apache Cassandra)
- Managed Apache Cassandra, an open source NoSQL distributed database.
- Serverless, scalable, highly available, fully managed. Tables scale up and down automatically with traffic; data is replicated 3 times across multiple AZ.
- Queries use CQL (Cassandra Query Language).
- Capacity: on-demand or provisioned with auto scaling. Use cases: IoT device data, time series data.
Amazon Timestream
- Fully managed, serverless time series database: each point is a time and one or more values (CPU usage per minute, temperature from a sensor).
- Faster and cheaper than storing this kind of data in a relational SQL database.
- Recent data is kept in memory, older data is moved to a cost optimised storage tier automatically.
- SQL compatible queries and built-in time series functions. Use cases: IoT, operational monitoring, real time analytics.
Transactions with complex joins?
RDS or Aurora.Migrate a MongoDB app to a managed AWS database?
DocumentDB.Social network, friends of friends, relationships?
Neptune.React to every change in a graph, in order?
Neptune Streams.Managed Apache Cassandra, CQL queries?
Amazon Keyspaces.Sensor readings or metrics with timestamps?
Timestream.Free text search on JSON documents?
OpenSearch.SQL analytics and BI on large data?
Redshift (or Athena directly on S3).Check yourself
- You are building a social network and need fast queries on friends, posts, comments and likes. Which database?
- A company wants to move its MongoDB application to a fully managed AWS database. Which service?
- Your team runs Apache Cassandra and wants a serverless managed version on AWS. Which service?
- Which query language does Amazon Keyspaces use?
- Thousands of IoT sensors send a temperature reading every minute. You need a serverless store that is cheaper and faster than a relational database for this. Which service?
- What does Neptune Streams give you?
- An application needs transactions and complex joins across several tables. Which service fits best?
- Which of these are NoSQL databases?
- Users need free text search over unstructured JSON documents. Which service?
- In Amazon Timestream, recent data is kept in memory and older data is moved automatically to a cheaper storage tier.
Chapter 24: Machine learning services: Rekognition, Transcribe, Polly, Comprehend, SageMaker and more
For the Architect Associate you don't build models: you only need to match each managed AI service to its use case. Most are "send data, get a result" APIs with no ML knowledge needed.
Images, video and documents
| Service | What it does | Example |
|---|---|---|
| Rekognition | Find objects, people, text, scenes in images and videos; facial analysis and search; content moderation | Flag inappropriate images on a social app, count people in a store video |
| Textract | Extract text, handwriting, forms and tables from scanned documents | Read invoices, ID documents, tax forms |
Speech and language
| Service | What it does | Example |
|---|---|---|
| Transcribe | Speech to text; can redact personal data automatically, detect language | Subtitles, call centre transcripts |
| Polly | Text to speech; lexicons (custom pronunciation) and SSML (pauses, emphasis) | Talking apps, audio articles |
| Translate | Natural language translation | Localise a website or reviews |
| Comprehend | NLP: find language, key phrases, entities, sentiment, topics in text | Analyse customer emails and reviews |
| Comprehend Medical | Extract health information from clinical text (HIPAA eligible) | Doctor's notes, prescriptions |
| Lex | Build chatbots with voice and text (same tech as Alexa) | Booking bot on a website |
| Connect | Cloud contact centre; pairs with Lex for virtual agents | Customer service phone line |
Search, recommendations, forecasting
| Service | What it does | Example |
|---|---|---|
| Kendra | ML powered document search across your files (natural language questions) | "Where is the IT support desk?" answered from internal docs |
| Personalize | Real time personalised recommendations (same tech as amazon.com) | Product suggestions, "you may also like" |
| Forecast | Time series forecasting | Predict next quarter's sales or demand |
Build your own: SageMaker
- Fully managed service for data scientists to build, train and deploy their own ML models.
- Pick it when the question says "custom model", "train", "data scientists".
- Amazon Bedrock: managed access to foundation models for generative AI apps.
Detect unsafe images or faces in photos?
Rekognition.Turn audio into text?
Transcribe. Text into audio? Polly.Sentiment of customer reviews?
Comprehend.Extract fields from scanned forms?
Textract.Chatbot?
Lex (plus Connect for a call centre).Search internal documents in natural language?
Kendra.Product recommendations?
Personalize.Train a custom model?
SageMaker.Check yourself
- A social app must automatically detect inappropriate content in uploaded photos. Which service?
- You need subtitles generated from video audio. Which service?
- Your app must read articles aloud with a natural voice. Which service?
- Which service finds the sentiment (positive or negative) of customer reviews?
- You must extract fields and tables from scanned invoices. Which service?
- Which service builds voice and text chatbots?
- Employees want to ask natural language questions and get answers from internal documents. Which service?
- An online shop wants real time product recommendations. Which service?
- Data scientists need to build, train and deploy their own models. Which service?
- Which service predicts future values such as next quarter's product demand?
Chapter 25: Monitoring and audit: CloudWatch, EventBridge, CloudTrail and AWS Config
Four services, four questions: how is it performing (CloudWatch), what should react to it (EventBridge), who did what (CloudTrail), and is it configured correctly (Config).
metrics, logs, alarms
react to events
API call history
configuration compliance
Amazon CloudWatch
Metrics
- Metrics for every service, grouped in namespaces, with dimensions (instance ID, environment...).
- EC2: every 5 min by default, 1 min with detailed monitoring (paid).
- RAM, disk space and processes are not default EC2 metrics: install the CloudWatch Unified Agent (config can be stored in SSM Parameter Store).
- Custom metrics with PutMetricData, standard (1 min) or high resolution (1, 5, 10, 30 s).
- Metric Streams: send metrics in near real time to Firehose or a partner (Datadog, Splunk...).
Logs
- Log groups (one per app) and log streams (one per instance or container). Retention: 1 day to 10 years, or never expire.
- Sources: SDK, Unified Agent, Beanstalk, ECS, Lambda, VPC Flow Logs, API Gateway, CloudTrail, Route 53 queries.
- Logs Insights: query language to search and aggregate logs.
- Export to S3: batch only, can take up to 12 h. For real time use subscription filters to Kinesis Data Streams, Firehose, Lambda or OpenSearch.
- Cross-account and cross-region aggregation via subscription filters. Logs encrypted with KMS.
Alarms
- States: OK, INSUFFICIENT_DATA, ALARM. Evaluated over a period.
- Actions: EC2 (stop, terminate, reboot, recover), Auto Scaling, SNS (and so anything).
- EC2 instance recovery: on a status check failure, the instance moves to new hardware and keeps the same private IP, public IP, Elastic IP, metadata and placement group.
- Composite alarms: combine alarms with AND / OR to reduce noise.
- Test with
set-alarm-state.
Insights
- Container Insights (ECS, EKS, Fargate), Lambda Insights, Contributor Insights (top N talkers, e.g. heaviest IPs), Application Insights.
Amazon EventBridge (formerly CloudWatch Events)
- Schedule (cron) jobs: run a Lambda every hour.
- Event pattern rules: react to service events, e.g. root user signs in → SNS email.
- Targets: Lambda, SQS, SNS, Step Functions, ECS tasks, Kinesis, CodePipeline, API destinations...
- Event buses: default (AWS services), partner (SaaS like Zendesk, Datadog), custom (your apps).
- Archive and replay events, schema registry.
- Resource-based policies: accept events from other accounts, e.g. one central bus for the whole organisation.
AWS CloudTrail
- History of API calls in your account (console, SDK, CLI, services): who did what, when, from where. Enabled by default.
- Event history kept 90 days. Longer: send a trail to S3 (query with Athena) or CloudWatch Logs.
- A trail can cover all regions (default) or one.
| Event type | Content | Logged by default? |
|---|---|---|
| Management events | Operations on resources (create bucket, attach policy, create subnet) | Yes |
| Data events | S3 object level (GetObject, PutObject), Lambda invokes | No (high volume) |
| CloudTrail Insights | Unusual activity: bursts of calls, hitting limits | No (paid option) |
AWS Config
- Records the configuration of resources and its changes over time, and checks them against rules for compliance.
- Managed rules (75+) or custom rules (Lambda). Examples: is SSH open to the world? are buckets public? is every EBS volume encrypted?
- Evaluated on every change or on a schedule. Config doesn't prevent actions (no deny).
- Remediation: SSM Automation documents fix non-compliant resources automatically (with retries).
- Notifications through EventBridge or SNS. Per region, can be aggregated across regions and accounts.
Which one? Example with a load balancer
| Service | What it tells you about the ELB |
|---|---|
| CloudWatch | Incoming connections, error codes, latency; alarm and dashboard |
| Config | Security group rule history, config changes, is SSL always on? |
| CloudTrail | Who changed the ELB through the API, and when |
Monitor EC2 memory usage?
Install the CloudWatch Unified Agent (custom metric).Stream logs in real time to OpenSearch or Lambda?
CloudWatch Logs subscription filter (export to S3 is batch).Instance fails a status check: same IPs on new hardware?
CloudWatch alarm with the EC2 recover action.Run a Lambda every night?
EventBridge schedule rule.Who deleted the bucket?
CloudTrail.Audit and auto-fix non-compliant security groups?
AWS Config rule + SSM Automation remediation.Check yourself
- You need to monitor RAM usage on EC2 instances. What do you do?
- How often are default EC2 metrics sent to CloudWatch, and with detailed monitoring?
- Logs must reach OpenSearch in near real time. Which CloudWatch Logs feature?
- An instance fails a system status check. You want it moved to new hardware keeping the same IPs. What do you use?
- Which feature combines several alarms with AND / OR to reduce alert noise?
- You want an email every time the root user signs in. What do you build?
- How long does CloudTrail keep events in its event history by default?
- CloudTrail logs S3 object level operations (data events) by default.
- You must check that no security group allows SSH from anywhere, and fix it automatically. Which service?
- AWS Config rules prevent non-compliant changes from happening.
Chapter 26: Advanced IAM: Organizations, SCPs, permission boundaries, Identity Center and Control Tower
Once a company has many AWS accounts and many people, it needs central control: who can log in where, and what no one is ever allowed to do.
AWS Organizations
- Manage many AWS accounts from one management account; the others are member accounts (each in only one organisation).
- Group accounts in Organizational Units (OU): by business unit, environment (prod, dev) or project.
- Consolidated billing: one bill, and pooled usage for volume discounts; Reserved Instances and Savings Plans discounts are shared across accounts.
- API to create accounts automatically. Other policies: tag policies, backup policies.
Service Control Policies (SCP)
- Guardrails: the maximum permissions allowed in an OU or account. They don't grant anything by themselves.
- Apply to every user and role of member accounts, including their root user.
- Do not apply to the management account.
- By default FullAWSAccess is attached. Strategies: deny list (allow all, deny some) or allow list.
- Explicit deny anywhere in the hierarchy (root, OU, account) wins.
- Example: deny everything outside eu-west-1, deny turning off CloudTrail, deny leaving the organisation.
IAM conditions to know
| Condition key | Use |
|---|---|
| aws:SourceIp | Deny calls not coming from your company's IP range |
| aws:RequestedRegion | Restrict actions to some regions |
| ec2:ResourceTag / aws:PrincipalTag | Allow actions only on resources with a matching tag (ABAC) |
| aws:MultiFactorPresent | Require MFA for sensitive actions |
| aws:PrincipalOrgID | In a bucket policy: only accounts of your organisation can access |
- S3 detail:
s3:ListBucketapplies toarn:aws:s3:::bucket, whiles3:GetObjectapplies toarn:aws:s3:::bucket/*.
Role vs resource-based policy (cross-account)
- Assuming a role: you give up your original permissions and only have the role's.
- Resource-based policy (S3 bucket, SQS, SNS, Lambda...): you keep your own permissions. Better when you need to read in account A and write in account B.
- EventBridge targets: Lambda, SNS, SQS, S3, API Gateway use resource-based policies; Kinesis, ECS tasks, SSM Run Command use an IAM role.
Permission boundaries and policy evaluation
- A permission boundary is a managed policy that sets the maximum permissions an IAM user or role can get (not groups).
- Effective permissions = intersection of SCP, permission boundary and identity policy.
- Use case: let developers create their own roles without escalating to admin.
Evaluation order (simplified)
Anything not explicitly allowed is denied (implicit deny).
IAM Identity Center and Directory Services
AWS IAM Identity Center (successor to AWS SSO)
- One login for all accounts of the organisation, business apps (Salesforce, Microsoft 365...), SAML 2.0 apps and EC2 Windows instances.
- Identity source: built-in store, or Active Directory, Okta, OneLogin...
- Permission sets define what a user gets in which account. Supports ABAC with user attributes.
AWS Directory Services
| Option | What it is |
|---|---|
| AWS Managed Microsoft AD | A real AD in AWS; can trust your on-prem AD; MFA |
| AD Connector | A proxy that sends auth to your on-prem AD; users stay on-prem |
| Simple AD | AD compatible, standalone in AWS; cannot join on-prem AD |
AWS Control Tower
- Sets up a secure multi-account environment in a few clicks, following best practices. Runs on top of Organizations.
- Automates account setup, monitors compliance in a dashboard.
- Controls (guardrails): preventive (implemented with SCPs), detective (implemented with AWS Config), proactive (checks before deployment).
Block every account in an OU from using a service, even their root user?
An SCP on the OU.Do SCPs restrict the management account?
No.Bucket accessible only by accounts in our organisation?
Bucket policy with aws:PrincipalOrgID.Let developers create roles but never exceed set permissions?
Permission boundaries.One sign-in to all accounts and SaaS apps?
IAM Identity Center.Use on-prem AD users without syncing them to AWS?
AD Connector.Quick, governed multi-account landing zone?
Control Tower.Check yourself
- You want to prevent all accounts in the Dev OU from launching resources outside eu-west-1, including their root users. What do you use?
- Service Control Policies restrict the management account of the organisation.
- An S3 bucket must be readable only by accounts in your AWS Organization. Which condition?
- What is the main benefit of consolidated billing in Organizations?
- Developers may create IAM roles, but those roles must never exceed a set of permissions. What do you use?
- A user in account A must read from a bucket in account B and write to a bucket in account A at the same time. Best approach?
- Employees need one login for all AWS accounts in the organisation and for Microsoft 365. Which service?
- You want to authenticate AWS users against your on-prem Active Directory without storing users in AWS. Which option?
- In AWS Control Tower, how are detective controls implemented?
- An identity policy allows s3:DeleteObject, but an SCP on the account explicitly denies it. Result?
Chapter 27: Encryption and security: KMS, Secrets Manager, ACM, WAF, Shield, GuardDuty, Inspector and Macie
Encryption protects data in flight (TLS) and at rest (KMS keys). The security services then protect, detect and report: firewalls, DDoS protection and threat detection.
AWS KMS, Key Management Service
- AWS manages encryption keys for you. Integrated with IAM, and every key use is logged in CloudTrail.
- Used by EBS, S3, RDS, SSM, Secrets Manager... Never store secrets in plain text in code.
- Key types: symmetric (AES-256, one key, never leaves KMS, used through the API) and asymmetric (RSA / ECC pair, public key can be downloaded to encrypt outside AWS).
| Key ownership | Cost | Rotation |
|---|---|---|
| AWS owned keys | Free | Managed by AWS (used by SSE-S3, SSE-SQS, DynamoDB default) |
| AWS managed keys (aws/rds, aws/ebs...) | Free | Automatic, every year |
| Customer managed keys | $1 / month | Automatic (configurable) or on demand |
| Imported key material | $1 / month | Manual only |
- Plus about $0.03 per 10,000 API calls.
- Keys are regional. Copying an encrypted EBS snapshot to another region: it is re-encrypted with a key in the new region.
- Key policies: without one allowing access, nobody can use the key. Default policy gives the account access, then IAM decides. Custom policies for cross-account.
- Share an encrypted snapshot or AMI with another account: share it, and allow that account in the key policy.
- Multi-region keys: same key ID and material replicated in several regions, so data encrypted in one can be decrypted in another (global client-side encryption, DynamoDB global tables, Aurora Global).
- S3 replication of SSE-KMS objects must be enabled explicitly, with the target key and the right permissions.
Storing secrets: Parameter Store vs Secrets Manager
| SSM Parameter Store | Secrets Manager | |
|---|---|---|
| Stores | Configuration and secrets, in a hierarchy (/my-app/dev/db-url) | Secrets (passwords, API keys) |
| Encryption | Optional, KMS | Always, KMS |
| Rotation | No native rotation | Automatic rotation every X days (Lambda) |
| Integration | CloudFormation, versioning, notifications | Native with RDS, Aurora, Redshift, DocumentDB |
| Multi-region | No | Replicas in other regions, promotable for DR |
| Cost | Standard tier free | About $0.40 / secret / month |
AWS Certificate Manager (ACM)
- Provision and manage TLS certificates for HTTPS. Public certificates are free and renew automatically.
- Works with ELB (ALB, NLB), CloudFront and API Gateway. Not on EC2 directly (the certificate can't be extracted).
- Validation: DNS (CNAME record, preferred, needed for auto renewal) or email.
- Imported certificates don't auto renew: ACM sends expiry events from 45 days before (EventBridge), and Config has a rule to check expiry.
- Certificate region: CloudFront and edge-optimized API Gateway need us-east-1; others need the resource's region.
Protecting apps: WAF, Shield and Firewall Manager
AWS WAF, Web Application Firewall
- Protects against layer 7 (HTTP) exploits. Deploy on ALB, API Gateway, CloudFront, AppSync, Cognito user pools. Not on NLB.
- Web ACL rules: IP sets, headers, body, URI strings, SQL injection, cross-site scripting (XSS), size limits, geo match, rate-based rules (count requests per IP, for DDoS).
- Web ACLs are regional, except for CloudFront (global).
- Need a fixed IP plus WAF? NLB doesn't support WAF: use Global Accelerator (fixed IPs) → ALB with WAF.
AWS Shield
- Shield Standard: free, automatic, against layer 3 / 4 attacks (SYN / UDP floods, reflection).
- Shield Advanced: about $3,000 / month per organisation. Protects EC2, ELB, CloudFront, Global Accelerator, Route 53. 24/7 Shield Response Team, cost protection for scaling spikes during attacks, automatic layer 7 mitigation with WAF rules.
AWS Firewall Manager
- Manage security rules across all accounts of an organisation: WAF rules, Shield Advanced, security groups, Network Firewall, Route 53 Resolver DNS Firewall.
- Rules apply automatically to new resources (e.g. every new ALB in any account).
Detecting threats: GuardDuty, Inspector, Macie
| Service | What it does |
|---|---|
| GuardDuty | Intelligent threat detection with ML on CloudTrail, VPC Flow Logs and DNS logs (optional: EKS, RDS logins, S3, EBS, Lambda). Finds e.g. cryptocurrency mining, compromised instances. Findings go to EventBridge. |
| Inspector | Automated vulnerability scanning of EC2 instances (via SSM agent: OS packages, network reachability), ECR container images and Lambda functions. Risk score per finding. |
| Macie | Uses ML to find sensitive data (PII) in S3 buckets and alert you. |
Audit every use of an encryption key?
KMS (logged in CloudTrail).Copy an encrypted snapshot to another region?
Re-encrypt with a KMS key in the target region.Database password rotated automatically?
Secrets Manager.Free, auto-renewing HTTPS certificate on an ALB?
ACM public certificate.Block SQL injection and rate-limit IPs?
WAF on ALB, API Gateway or CloudFront.DDoS support team and cost protection?
Shield Advanced.Same WAF rules on every account in the organisation?
Firewall Manager.Detect crypto mining on EC2?
GuardDuty. Scan for CVEs? Inspector. Find PII in S3? Macie.Check yourself
- You copy an encrypted EBS snapshot from eu-west-1 to us-east-1. What happens to encryption?
- Which KMS key type costs about $1 per month and supports automatic rotation you configure?
- An RDS database password must be rotated automatically every 30 days. Which service?
- You can install an ACM public certificate directly on an EC2 instance.
- In which region must the ACM certificate be for a CloudFront distribution?
- You must block SQL injection attempts on your web app behind an ALB. Which service?
- Your app sits behind an NLB and needs WAF protection with fixed IPs. What do you do?
- What does Shield Advanced add over Shield Standard?
- Which service uses ML on CloudTrail, VPC Flow Logs and DNS logs to detect threats like crypto mining?
- You must discover personal data stored in S3 buckets. Which service?
Chapter 28: VPC part 1: CIDR, subnets, gateways, NAT, NACLs, peering and endpoints
A VPC (Virtual Private Cloud) is your own private network in an AWS region. VPC is one of the heaviest topics on the exam.
CIDR and private IP ranges
- A CIDR is a base IP plus a mask that says how many addresses:
/32= 1 IP,/24= 256,/16= 65,536,0.0.0.0/0= all IPs. - Each smaller number doubles the count:
/27= 32,/26= 64,/25= 128. - Private ranges: 10.0.0.0/8, 172.16.0.0/12 (default VPC uses 172.31.0.0/16), 192.168.0.0/16.
VPC and subnets
- Every account has a default VPC per region with a public subnet in each AZ: new instances get a public IPv4.
- Max 5 VPCs per region (soft limit). Up to 5 CIDRs per VPC, each between /28 (16 IPs) and /16 (65,536 IPs).
- Use private ranges only, and don't overlap with your other networks (e.g. corporate).
- A subnet lives in one AZ. Public subnet = has a route to an internet gateway. Private subnet = no direct route.
Need 29 IPs? /27 gives 32 - 5 = 27, not enough. Pick /26 (64 - 5 = 59).
Getting to the internet
Internet Gateway (IGW)
- Lets resources in a VPC reach the internet. Scales horizontally, highly available. One VPC = one IGW.
- Alone it does nothing: the route table must send
0.0.0.0/0 → IGW.
Bastion host
- EC2 in a public subnet used to SSH into private instances. Its security group allows port 22 only from your company's public IP range. Private instances allow SSH from the bastion's security group.
- Modern alternative: SSM Session Manager (no port 22 at all).
NAT: private instances reaching the internet (outbound only)
| NAT Gateway | NAT instance (legacy) | |
|---|---|---|
| Managed by | AWS | You (EC2 with a NAT AMI) |
| Availability | HA within one AZ: create one per AZ for fault tolerance | Script failover yourself |
| Bandwidth | 5 Gbps, scales up to 100 Gbps | Depends on instance type |
| Security groups | None to manage | You manage them |
| Setup | Elastic IP, in a public subnet | Elastic IP, disable source / destination check |
| Bastion? | No | Yes, possible |
NACL vs security group
| Security group | Network ACL | |
|---|---|---|
| Level | Instance (ENI) | Subnet |
| Rules | Allow only | Allow and deny |
| State | Stateful: return traffic auto allowed | Stateless: return traffic must be allowed explicitly |
| Evaluation | All rules | In order, lowest number first, first match wins |
- NACL rules numbered 1 to 32,766, last rule
*denies. Default NACL allows everything; a new custom NACL denies everything. - Great to block a specific IP at subnet level (security groups can't deny).
- Ephemeral ports (1024 to 65535): clients answer on random ports, so NACLs must allow them in both directions.
VPC peering and VPC endpoints
VPC peering
- Privately connects two VPCs over the AWS network, so they act as one. Works cross-account and cross-region.
- CIDRs must not overlap. Not transitive: A↔B and B↔C does not give A↔C.
- Update the route tables in each VPC. You can reference a peered VPC's security group (same region).
VPC endpoints (PrivateLink)
Reach AWS services privately, without an IGW or NAT.
| Gateway endpoint | Interface endpoint | |
|---|---|---|
| Services | S3 and DynamoDB only | Most services (and S3) |
| How | Target in the route table | An ENI with a private IP; needs a security group |
| Cost | Free | Per hour + per GB |
| Prefer when | Usually the answer for S3 / DynamoDB | Access needed from on-prem (VPN / DX), another VPC or region |
- Not working? Check the VPC's DNS resolution and DNS hostnames settings, and route tables.
VPC Flow Logs
- Capture IP traffic info at VPC, subnet or ENI level (also ELB, RDS, NAT Gateway, Transit Gateway...).
- Send to S3, CloudWatch Logs or Firehose; query with Athena or Logs Insights.
- Fields: srcaddr, dstaddr, srcport, dstport, action (ACCEPT / REJECT).
- Troubleshooting: inbound REJECT → NACL or security group. Inbound ACCEPT but outbound REJECT → NACL (stateless).
How many usable IPs in a /28 subnet?
16 - 5 = 11.Private instances need to download patches from the internet?
NAT Gateway in a public subnet (one per AZ for HA).NAT instance not forwarding traffic?
Disable the source / destination check.Block one attacker IP for a whole subnet?
NACL deny rule.VPC A peers with B, B with C. Can A reach C?
No, peering isn't transitive.Private EC2 reaching S3 with no internet and no cost?
Gateway VPC endpoint.Check yourself
- How many IP addresses does AWS reserve in each subnet?
- You need at least 29 usable IP addresses in a subnet. What is the smallest subnet size?
- Instances in a private subnet must download updates from the internet but never accept inbound connections. What do you use?
- How do you make NAT Gateways fault tolerant?
- A NAT instance doesn't forward any traffic. What setting is often forgotten?
- Which statements about Network ACLs are true?
- You must block one malicious IP address for an entire subnet. What do you use?
- VPC A is peered with B, and B with C. Can A talk to C?
- EC2 instances in a private subnet must access S3 privately at no extra cost. Which option?
- Flow Logs show inbound traffic ACCEPTED but the response REJECTED outbound. What is the likely cause?
Chapter 29: VPC part 2: Site-to-Site VPN, Direct Connect, Transit Gateway, IPv6, Network Firewall and network costs
How to connect your VPCs to your offices and data centres, connect many VPCs together, and keep network costs down.
AWS Site-to-Site VPN
- An encrypted IPsec tunnel over the public internet between your network and a VPC. Quick to set up.
- Virtual Private Gateway (VGW): the AWS side, attached to the VPC (custom ASN possible).
- Customer Gateway (CGW): your side, a software or hardware device. Use its public IP, or the public IP of the NAT device in front of it.
- Enable route propagation for the VGW in your route tables. To ping instances from on-prem, allow ICMP in the security group.
- VPN CloudHub: connect several sites to the same VGW, hub and spoke, so sites can also talk to each other through the VPN. Low cost.
AWS Direct Connect (DX)
- A dedicated private connection from your network to AWS through a Direct Connect location. Doesn't use the internet.
- Use cases: high bandwidth, cheaper large transfers, consistent network performance, hybrid environments.
- Reaches public resources (S3) and private ones (EC2) on the same connection. IPv4 and IPv6.
- Direct Connect Gateway: one DX to VPCs in many regions.
| Connection type | Capacity |
|---|---|
| Dedicated | 1, 10, 100 Gbps (and higher) physical port, requested from AWS then set up by partners |
| Hosted | 50 Mbps up to 10 Gbps and more, through an AWS partner; capacity can change on demand |
DX traffic is private but not encrypted: run a VPN over Direct Connect for IPsec encryption.
Resiliency
- High: one connection at each of two DX locations.
- Maximum: two connections on separate devices at each of two or more locations.
- Cheap backup: a Site-to-Site VPN used if the DX fails.
AWS Transit Gateway
- Hub and spoke connecting thousands of VPCs and on-prem networks. Transitive, unlike VPC peering.
- Regional; peer Transit Gateways across regions. Share across accounts with Resource Access Manager (RAM).
- Route tables control which VPC can talk to which.
- Works with Direct Connect Gateway and VPN connections.
- Only AWS service that supports IP multicast.
- ECMP (equal cost multi path): several Site-to-Site VPN connections to one Transit Gateway to multiply VPN bandwidth (each tunnel about 1.25 Gbps).
IPv6, egress-only gateway, traffic mirroring
- Every IPv6 address is public. You can't disable IPv4 in a VPC; IPv6 runs as dual stack.
- Can't launch an EC2 in a dual stack subnet? It's not IPv6: the subnet has no IPv4 left. Add a new IPv4 CIDR.
- Egress-only Internet Gateway: like a NAT Gateway but for IPv6: instances can go out, the internet can't come in. Route
::/0 → EIGW. - Traffic Mirroring: copy ENI traffic to an ENI or NLB for inspection (threat detection, troubleshooting).
AWS Network Firewall
- Protects a whole VPC from layer 3 to layer 7, in every direction: VPC to VPC, to and from the internet, to and from DX / VPN.
- Rules: IP and port filtering, protocol filtering, domain lists (allow only *.mycompany.com outbound), regex pattern matching. Actions allow, drop, alert. Intrusion prevention.
- Built on Gateway Load Balancer. Managed centrally across accounts with Firewall Manager. Logs to S3, CloudWatch Logs, Firehose.
Network costs (rough numbers)
| Traffic | Cost per GB |
|---|---|
| Into AWS (ingress) | Free |
| Between EC2 in the same AZ, private IP | Free |
| Between AZ, private IP | About $0.01 each way |
| Between AZ, public / Elastic IP | About $0.02 each way |
| Between regions | About $0.02 |
| S3 to internet | About $0.09 |
| S3 to CloudFront | Free (CloudFront to internet is a bit cheaper than S3) |
| NAT Gateway | Hourly fee + about $0.045 per GB processed |
| Gateway endpoint to S3 | Free |
- Use private IPs, keep chatty traffic in one AZ (trading off HA), use gateway endpoints instead of NAT for S3 / DynamoDB, keep processing inside AWS to cut egress.
Encrypted on-prem connection needed this week?
Site-to-Site VPN.Consistent, high bandwidth private link?
Direct Connect (plan for a month+ lead time).Encrypt Direct Connect traffic?
VPN over Direct Connect.Cheap backup if DX fails?
Site-to-Site VPN.Connect hundreds of VPCs and on-prem transitively?
Transit Gateway.More VPN bandwidth?
Transit Gateway with ECMP over several VPN connections.IPv6 instances must reach out but not be reachable?
Egress-only Internet Gateway.Filter outbound traffic by domain for a whole VPC?
AWS Network Firewall.Check yourself
- You need an encrypted connection between your data centre and a VPC, working within days. What do you use?
- Which components does a Site-to-Site VPN need?
- Direct Connect traffic must be encrypted. What do you do?
- What is a cost effective backup for a Direct Connect connection?
- One Direct Connect connection must reach VPCs in several regions. What do you add?
- You must connect 200 VPCs and on-prem networks with transitive routing. Which service?
- How do you increase bandwidth of Site-to-Site VPN connections to AWS?
- Which AWS service supports IP multicast?
- IPv6 instances must initiate outbound connections but never accept inbound ones from the internet. What do you use?
- Which EC2 to EC2 traffic is free?
Chapter 30: Disaster recovery and migration: RPO, RTO, DR strategies, DMS, AWS Backup and MGN
Disaster recovery (DR) is how fast you come back and how much data you lose after a failure. Migration is moving servers and databases into AWS with as little downtime as possible.
RPO and RTO
- RPO, Recovery Point Objective: how much data you can lose. The time between the last backup or replication and the disaster.
- RTO, Recovery Time Objective: how long you can be down. The time between the disaster and being back online.
- Smaller RPO and RTO = more expensive.
The 4 DR strategies (cheapest and slowest first)
| Strategy | How | RPO / RTO |
|---|---|---|
| Backup and restore | Back up to AWS (snapshots, S3, Storage Gateway, Snowball). Rebuild everything after a disaster. | Hours / hours. Cheapest. |
| Pilot light | Only the critical core (e.g. the database, replicated) runs in AWS. Start the rest on disaster. | Minutes / tens of minutes. |
| Warm standby | The full system runs at minimum size. Scale up to production on disaster (ASG, Route 53 failover). | Seconds to minutes / minutes. |
| Multi-site / hot site | Full production scale running in both places, active-active. | Near zero / near zero. Most expensive. |
DR tips
- Backups: EBS snapshots, RDS automated backups, S3 lifecycle to IA / Glacier, Cross Region Replication.
- HA: Route 53 to move DNS between regions, RDS Multi-AZ, ElastiCache Multi-AZ, EFS, S3. Site-to-Site VPN as backup for Direct Connect.
- Replication: RDS cross-region read replicas, Aurora Global Database, Storage Gateway.
- Automation: CloudFormation or Beanstalk to rebuild, CloudWatch alarms to recover EC2.
- Chaos testing: AWS Fault Injection Service.
AWS DMS, Database Migration Service
- Migrate databases to AWS quickly and securely. The source database stays available during the migration.
- Homogeneous (Oracle → Oracle) or heterogeneous (SQL Server → Aurora) migrations.
- Continuous replication with CDC (change data capture) to keep the target in sync until cut-over.
- Runs replication tasks on an EC2 replication instance (or DMS Serverless). Multi-AZ option: synchronous standby replica.
- Sources: on-prem / EC2 databases (Oracle, SQL Server, MySQL, MariaDB, PostgreSQL, MongoDB, SAP, DB2), Azure SQL, RDS, Aurora, S3, DocumentDB.
- Targets: databases, RDS, Aurora, Redshift, DynamoDB, S3, OpenSearch, Kinesis, Kafka, DocumentDB, Neptune, Redis.
AWS SCT, Schema Conversion Tool
- Converts the schema from one engine to another (Oracle → PostgreSQL, Teradata → Redshift).
- Not needed when the engine stays the same (on-prem PostgreSQL → RDS PostgreSQL).
Into Aurora
- RDS MySQL → Aurora MySQL: restore a snapshot as Aurora (some downtime), or create an Aurora read replica of the RDS DB and promote it (less downtime).
- External MySQL → Aurora: Percona XtraBackup to S3, then create Aurora from S3 (or mysqldump, slower).
- Both databases up and running: use DMS.
Migrating servers
- AWS Application Discovery Service: gathers info about on-prem servers to plan a migration. Agentless (VM inventory, CPU, memory, disk) or agent-based (processes, network connections, dependencies). Tracked in Migration Hub.
- AWS Application Migration Service (MGN): lift and shift (rehost) physical, virtual or cloud servers to AWS. Continuous replication to a low-cost staging area, then a quick cut-over with minimal downtime.
- VM Import / Export: import VM images as AMIs. VMware Cloud on AWS: run vSphere workloads on AWS.
AWS Backup
- Fully managed, central backups across services: EC2 / EBS, S3, RDS, Aurora, DynamoDB, DocumentDB, Neptune, EFS, FSx, Storage Gateway volumes.
- Cross-region and cross-account backups, point in time recovery for supported services, tag-based policies.
- Backup plans: frequency, backup window, move to cold storage, retention.
- Backup Vault Lock: WORM (write once, read many). Backups can't be deleted, even by the root user.
Moving a lot of data: how long?
Example: 200 TB to move. 200 TB = 1,600,000,000 Mb.
| Method | Time |
|---|---|
| Internet, 100 Mbps | 1,600,000,000 ÷ 100 = 16,000,000 s ≈ 185 days |
| Direct Connect, 1 Gbps | ≈ 18.5 days, plus over a month to set it up |
| Snowball (2 or 3 in parallel) | About 1 week end to end |
Ongoing replication after the bulk move: Site-to-Site VPN or DX with DMS or DataSync.
Cheapest DR, hours of downtime acceptable?
Backup and restore.Only the database replicated, the rest started on demand?
Pilot light.Scaled-down full copy running, scale up on failure?
Warm standby.Near zero RTO, cost no issue?
Multi-site active-active.Migrate Oracle to Aurora PostgreSQL with the source still live?
SCT for the schema + DMS with CDC.Lift and shift hundreds of on-prem servers?
Application Migration Service (MGN).Backups no one can delete, not even root?
AWS Backup Vault Lock.Check yourself
- What does RPO measure?
- Which DR strategy keeps only the critical core (like a replicated database) running in AWS?
- A full copy of the system runs at minimum size and scales up on disaster. Which strategy?
- Which DR strategy gives the lowest RTO and RPO at the highest cost?
- You migrate Oracle to Aurora PostgreSQL while the source stays in use. What do you use?
- You need the Schema Conversion Tool to migrate on-prem PostgreSQL to RDS for PostgreSQL.
- What is the least downtime way to move RDS MySQL to Aurora MySQL?
- You need to rehost hundreds of on-prem servers on AWS with minimal downtime. Which service?
- Backups must be impossible to delete, even by the root user. What do you enable?
- About how long does it take to send 200 TB over a 100 Mbps internet link?
Chapter 31: Other services and the Well-Architected Framework: CloudFormation, Systems Manager, cost tools, Batch, HPC
The last batch of services that show up in exam questions, and the six pillars that every answer is judged against.
AWS CloudFormation
- Infrastructure as code: describe resources in a YAML or JSON template; CloudFormation creates them as a stack, in the right order.
- Benefits: no manual work, version control, cost tags per stack, delete and recreate environments (e.g. dev off at night), reuse templates.
- Service role: an IAM role CloudFormation uses to create resources, so users only need
iam:PassRole(least privilege). - StackSets: deploy one stack to many accounts and regions at once.
AWS Systems Manager (SSM)
| Feature | What it does |
|---|---|
| Session Manager | Shell into EC2 and on-prem servers without SSH, port 22, keys or a bastion. Needs the SSM agent and an IAM role. Sessions logged to S3 / CloudWatch. |
| Run Command | Run a script or command on a whole fleet, no SSH. Output to S3 / CloudWatch, can be triggered by EventBridge. |
| Patch Manager | Automate OS and app patching on EC2 and on-prem, on demand or on a schedule, with compliance reports. |
| Maintenance Windows | Schedule when actions (patches, scripts) run. |
| Automation | Runbooks for common tasks: restart instances, create AMIs, snapshot EBS. Triggered manually, by EventBridge, Maintenance Windows or AWS Config remediation. |
| Parameter Store | Configuration and secrets (see chapter 27). |
Cost management tools
| Tool | Use it to |
|---|---|
| Cost Explorer | Visualise costs over time, build reports, forecast future spend, get Savings Plan recommendations |
| Cost Anomaly Detection | ML spots unusual spending and alerts you, with root cause |
| AWS Budgets | Alerts (SNS, email) when cost, usage or reservation use passes a threshold; Budget Actions can act automatically |
| Compute Optimizer | ML right-sizing recommendations for EC2, ASG, EBS, Lambda, ECS on Fargate, RDS |
| Trusted Advisor | Checks across cost, performance, security, fault tolerance, service limits. Full checks need Business or Enterprise support |
| Instance Scheduler | AWS solution to stop / start EC2 and RDS on a schedule (e.g. outside office hours) |
More services to recognise
- Amazon SES: send (and receive) emails at scale: transactional, marketing, bulk. DKIM and SPF, reputation dashboard, bounce and open stats.
- Amazon Pinpoint: 2-way marketing campaigns over email, SMS, push, voice, with segments and templates. AWS is retiring its campaign features; SMS and push live on as AWS End User Messaging. Can still appear in questions.
- AWS Outposts: AWS racks installed in your own data centre, running EC2, EBS, S3, EKS, ECS, RDS, EMR. For low latency, local data processing, data residency. You handle physical security.
- AWS AppFlow: transfer data between SaaS apps (Salesforce, SAP, Zendesk, Slack) and AWS (S3, Redshift), on a schedule, on event or on demand.
- AWS Amplify: build and deploy full-stack web and mobile apps (auth, storage, API, CI/CD), "Beanstalk for web and mobile apps".
AWS Batch vs Lambda
| Lambda | AWS Batch | |
|---|---|---|
| Time limit | 15 min | None |
| Runtime | Supported runtimes | Any, packaged as a Docker image |
| Disk | /tmp up to 10 GB | EBS or instance store |
| Compute | Serverless | Managed EC2 or spot (or Fargate) |
High Performance Computing (HPC) on AWS
- Data in: Direct Connect, Snowball, DataSync.
- Compute: compute or GPU optimised EC2, spot fleets, cluster placement group (lowest latency).
- Networking: ENA (enhanced networking, up to 100 Gbps), EFA (Elastic Fabric Adapter): ENA for tightly coupled HPC on Linux, uses MPI and bypasses the OS for very low latency.
- Storage: EBS io2 Block Express, instance store, S3, EFS, FSx for Lustre.
- Automation: AWS Batch, AWS ParallelCluster (open source tool to deploy HPC clusters, can enable EFA).
AWS Well-Architected Framework: the 6 pillars
run, monitor, improve
protect data and systems
recover, scale, avoid failure
right resources, keep up with demand
no waste
reduce environmental impact
- They work together, they are not trade-offs to pick between.
- Principles: stop guessing capacity, test at production scale, automate, allow evolutionary architectures, decide with data, practise with game days.
- Well-Architected Tool: free, review your workloads against the pillars and get advice.
Same infrastructure in 10 accounts and 3 regions?
CloudFormation StackSets.Shell access with no SSH and no open ports?
SSM Session Manager.Patch a fleet of EC2 and on-prem servers on a schedule?
SSM Patch Manager + Maintenance Windows.Get alerted when spend goes over a threshold?
AWS Budgets.Right-size over-provisioned instances?
Compute Optimizer.Batch job running 6 hours in a Docker image?
AWS Batch.Run AWS services in your own data centre?
Outposts.Tightly coupled HPC needing the lowest latency between nodes?
EFA + cluster placement group.Check yourself
- You must deploy the same CloudFormation stack to 10 accounts across 3 regions. Which feature?
- How can users deploy CloudFormation stacks without having direct permissions on every resource?
- Security wants shell access to EC2 with no SSH keys, no port 22 and no bastion. Which feature?
- Which tool gives ML-based right-sizing recommendations for EC2, EBS and Lambda?
- You want an email when this month's spend is forecast to exceed $1,000. Which service?
- A batch job runs 6 hours inside a Docker image. Which service fits best?
- Regulations require data to stay in your own data centre, but you want AWS services and APIs there. Which option?
- Which network option suits tightly coupled HPC workloads on Linux with MPI?
- Which are pillars of the AWS Well-Architected Framework?
- You need to sync Salesforce data into S3 every hour without writing code. Which service?