AWS Essentials
The five services you will use on every project - and what each one actually does.
EC2 - Virtual Servers
EC2 (Elastic Compute Cloud) gives you virtual servers in the cloud. Pick the operating system, CPU, RAM, and storage. You pay by the hour or second. Use it when you need a full server - running a database, a backend API, or anything that needs to be "always on."
Start with t3.micro (free tier eligible) for learning. Move to t3.medium or larger for production.
# Launch an EC2 instance with AWS CLI
aws ec2 run-instances \
--image-id ami-0abcdef1234567890 \
--instance-type t3.micro \
--key-name my-key-pair \
--security-group-ids sg-0123456789abcdef0 \
--count 1
# SSH into your instance
ssh -i my-key-pair.pem ec2-user@<public-ip>S3 - Object Storage
S3 (Simple Storage Service) stores files. Images, PDFs, backups, static website files - anything. It is virtually unlimited, incredibly durable (99.999999999% - eleven nines), and cheap. Most applications use S3 for user uploads, static assets, and data lake storage.
# Create a bucket
aws s3 mb s3://my-company-assets
# Upload a file
aws s3 cp report.pdf s3://my-company-assets/reports/
# Sync a directory
aws s3 sync ./build s3://my-website-bucket --delete
# Generate a pre-signed URL (temporary access)
aws s3 presign s3://my-company-assets/reports/report.pdf --expires-in 3600Lambda - Serverless Functions
Lambda runs code without managing servers. Upload your function, define a trigger (HTTP request, S3 upload, schedule), and AWS handles everything else. You only pay when the function executes. Perfect for APIs with variable traffic, image processing, scheduled tasks, and event-driven workflows.
// A simple Lambda function (Node.js)
exports.handler = async (event) => {
const name = event.queryStringParameters?.name || 'World';
return {
statusCode: 200,
body: JSON.stringify({ message: `Hello, ${name}!` }),
};
};RDS - Managed Databases
RDS (Relational Database Service) runs PostgreSQL, MySQL, or other databases for you. AWS handles backups, patching, failover, and replication. You could run a database on EC2 yourself, but RDS saves you from 3 AM pages when your database crashes. For most teams, the convenience is worth the cost. Start with db.t3.micro for development.
IAM - Access Control
IAM (Identity and Access Management) controls who can do what. Every person, application, and service gets specific permissions. The golden rule: give the minimum permissions needed. Never use your root account for daily work.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::my-bucket/*"
},
{
"Effect": "Deny",
"Action": "s3:DeleteObject",
"Resource": "*"
}
]
}This policy allows reading and writing objects in a specific bucket, but denies deletion everywhere. Principle of least privilege in action.
When to Use What
- - EC2: Long-running servers, full control needed, legacy apps
- - S3: File storage, static hosting, backups, data lakes
- - Lambda: Event-driven tasks, APIs with variable traffic, scheduled jobs
- - RDS: Any relational database you do not want to manage yourself
- - IAM: Always. Every resource needs proper access controls from day one