Lesson 253 of 296
EC2, S3 and RDS
What you will learn
- EC2: virtual servers, instance types, pricing models
- S3: object storage, buckets, storage classes, security
- RDS and Aurora: managed relational databases
- Backups, Multi-AZ and read replicas
On this page
EC2 (Elastic Compute Cloud)
EC2 provides virtual servers ("instances").
- Instance types combine CPU, memory and network: families such as
t(burstable, cheap, small apps),m(general purpose),c(compute-heavy),r(memory-heavy);gsuffix = AWS Graviton (ARM) processors, often better price-performance (m7g). - An AMI (Amazon Machine Image) is the disk image to boot from (Amazon Linux 2023, Ubuntu).
- EBS volumes are network disks attached to instances; snapshots back them up.
- Security groups control traffic (Lesson 257); key pairs or Session Manager provide access.
- User data scripts run at first boot to install software.
Pricing:
| Model | Meaning |
|---|---|
| On-Demand | Pay per second, no commitment |
| Savings Plans / Reserved | Commit to 1 or 3 years for big discounts |
| Spot | Spare capacity at large discounts, but AWS can reclaim it with two minutes' warning: for interruptible work like batch jobs and CI runners |
With EC2 you manage the operating system: patches, security, scaling. Often a managed service (ECS Fargate, Lambda, App Runner, Elastic Beanstalk) is less work; EC2 suits custom needs or steady workloads where you want control.
S3 (Simple Storage Service)
S3 stores objects (files plus metadata) in buckets, identified by keys (paths like tenants/42/report.pdf). It is designed for 99.999999999% (eleven nines) durability by storing data redundantly across multiple AZs.
- Bucket names are globally unique.
- There are no real folders:
/in keys is just a naming convention the console shows as folders. - Objects up to 5 TB (upload large ones with multipart, Lesson 242).
- Strong read-after-write consistency for all operations: after a successful write, reads return the new data.
Storage classes:
| Class | Use |
|---|---|
| S3 Standard | Frequently accessed data |
| S3 Intelligent-Tiering | Unknown or changing access patterns; moves objects between tiers automatically |
| S3 Standard-IA / One Zone-IA | Infrequent access, cheaper storage, retrieval fee |
| S3 Glacier (Instant, Flexible, Deep Archive) | Archives; cheapest storage, slower and paid retrieval |
Lifecycle rules move or delete objects automatically by age (Lesson 242).
Security essentials:
- Block Public Access is on by default for new buckets; keep it on unless the bucket truly serves public files (and even then, prefer CloudFront in front).
- Access through IAM policies and bucket policies; temporary access through pre-signed URLs (Lesson 242).
- Encryption at rest is on by default (SSE-S3); use KMS keys (SSE-KMS) when you need control and audit of the keys.
- Versioning keeps previous versions (protects against accidental deletes and overwrites); Object Lock prevents deletion for compliance.
- Public S3 buckets leaking data have been a famous cause of breaches: check permissions carefully.
Other uses: static website hosting (with CloudFront for HTTPS), data lakes, backups, logs, event triggers to Lambda when objects are created.
RDS (Relational Database Service)
RDS runs managed relational databases: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, Db2. AWS handles provisioning, patching, automated backups, monitoring and failover; you still design schemas, write queries and choose sizes.
| Feature | What it gives |
|---|---|
| Automated backups | Daily snapshots plus transaction logs: point-in-time restore to any second within the retention period (up to 35 days) |
| Manual snapshots | Kept until you delete them |
| Multi-AZ | A standby copy in another AZ, synchronously replicated; automatic failover if the primary fails (usually within a minute or two). For availability, not for scaling reads |
| Read replicas | Asynchronous copies for scaling reads and reporting (Lesson 235); can be in other regions |
| Encryption | At rest with KMS; in transit with TLS |
| Parameter groups | Database settings |
| Performance Insights / CloudWatch | Find slow queries and resource bottlenecks |
Amazon Aurora is AWS's cloud-native engine compatible with PostgreSQL and MySQL: storage is automatically replicated six ways across three AZs and grows automatically, with fast failover and up to 15 low-lag replicas. Aurora Serverless v2 scales capacity up and down automatically with load. Generally more expensive than standard RDS for small workloads, attractive for variable or demanding ones.
Good practice: put databases in private subnets (Lesson 257), allow connections only from the application's security group, store credentials in Secrets Manager with rotation, use RDS Proxy when many short-lived connections (Lambda) would overwhelm the database, and test restores regularly: a backup you have never restored is a hope, not a backup.
How to say it in an interview
"EC2 gives virtual servers where I choose the instance type and manage the operating system; I consider Spot for interruptible work and managed platforms when I do not need that control. S3 is durable object storage with strong read-after-write consistency; I keep Block Public Access on, use bucket and IAM policies and pre-signed URLs, versioning and lifecycle rules to cheaper classes. RDS manages relational databases with automated backups and point-in-time restore; Multi-AZ gives a synchronous standby for automatic failover, while read replicas scale reads. Aurora adds six-way replicated storage and serverless scaling. Databases go in private subnets, with credentials in Secrets Manager and regularly tested restores."
Key words
| Word | Meaning |
|---|---|
| EC2 instance | A virtual server |
| AMI | A machine image to boot instances from |
| EBS | Network block storage for EC2 |
| Spot instance | Cheap interruptible capacity |
| S3 bucket / object / key | Container / file / its name |
| Storage class | Price and access-speed tier in S3 |
| RDS | Managed relational database service |
| Multi-AZ | A synchronous standby in another AZ for failover |
| Point-in-time restore | Restore a database to any moment in the retention window |
| Aurora | AWS's cloud-native PostgreSQL/MySQL-compatible engine |
Now prove it
This lesson is complete when you pass the quiz and all three practice levels.