Skip to the content

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); g suffix = 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:

ModelMeaning
On-DemandPay per second, no commitment
Savings Plans / ReservedCommit to 1 or 3 years for big discounts
SpotSpare 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:

ClassUse
S3 StandardFrequently accessed data
S3 Intelligent-TieringUnknown or changing access patterns; moves objects between tiers automatically
S3 Standard-IA / One Zone-IAInfrequent 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.

FeatureWhat it gives
Automated backupsDaily snapshots plus transaction logs: point-in-time restore to any second within the retention period (up to 35 days)
Manual snapshotsKept until you delete them
Multi-AZA 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 replicasAsynchronous copies for scaling reads and reporting (Lesson 235); can be in other regions
EncryptionAt rest with KMS; in transit with TLS
Parameter groupsDatabase settings
Performance Insights / CloudWatchFind 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

WordMeaning
EC2 instanceA virtual server
AMIA machine image to boot instances from
EBSNetwork block storage for EC2
Spot instanceCheap interruptible capacity
S3 bucket / object / keyContainer / file / its name
Storage classPrice and access-speed tier in S3
RDSManaged relational database service
Multi-AZA synchronous standby in another AZ for failover
Point-in-time restoreRestore a database to any moment in the retention window
AuroraAWS's cloud-native PostgreSQL/MySQL-compatible engine

Now prove it

This lesson is complete when you pass the quiz and all three practice levels.