
AWS (Amazon Web Services) is the world's largest cloud provider. These core services cover compute, storage, database, networking, and identity — mastering them handles 80% of real-world AWS work.
| Item | Syntax | Description |
|---|---|---|
| EC2 | Elastic Compute Cloud — virtual machines | t3.micro free tier, m5.large general, c5.xlarge compute-optimized |
| AMI | Amazon Machine Image — OS snapshot | ami-0c55b159cbfafe1f0 = Ubuntu 20.04 |
| S3 | Simple Storage Service — object storage | Unlimited scale, 11 9s durability, $0.023/GB/month |
| S3 bucket policies | JSON policy on bucket | Control access — public read, cross-account, etc. |
| RDS | Relational Database Service — managed DB | MySQL, PostgreSQL, Oracle, SQL Server, MariaDB |
| RDS Multi-AZ | Automatic failover to standby | Production must use Multi-AZ — automatic failover <2 min |
| Aurora | MySQL/PostgreSQL-compatible, 5x faster than MySQL | Auto-scales storage, up to 15 read replicas |
| DynamoDB | Serverless NoSQL — single-digit ms at any scale | On-demand or provisioned, Global Tables for multi-region |
| Lambda | Serverless functions — event-driven compute | 15 min timeout, 10GB memory, pay per 100ms |
| API Gateway | Managed REST/HTTP/WebSocket API | Integrates with Lambda for serverless APIs |
| CloudFront | Global CDN — cache content at 400+ edge locations | Reduce latency, absorb DDoS, free SSL with ACM |
| Route 53 | Authoritative DNS + health checks + routing policies | Latency, weighted, failover, geolocation routing |
| VPC | Virtual Private Cloud — isolated network | Your own network: subnets, route tables, gateways |
| ELB | Elastic Load Balancing — ALB/NLB/CLB | ALB = Layer 7 (HTTP/S), NLB = Layer 4 (TCP/UDP) |
| Auto Scaling | Scale EC2/ECS/Lambda automatically | Target tracking: keep CPU at 60%, scale in/out |
| ECS | Elastic Container Service — managed Docker | Fargate (serverless) or EC2 launch type |
| EKS | Elastic Kubernetes Service — managed Kubernetes | Run k8s without managing control plane |
| ECR | Elastic Container Registry — private Docker registry | Integrated with ECS, EKS, and CodeBuild |
| IAM | Identity and Access Management | Users, groups, roles, policies — least privilege always |
| CloudFormation | Infrastructure as Code with JSON/YAML templates | Stack = group of AWS resources, change sets for updates |
| SQS | Simple Queue Service — message queuing | Decouple services, retry on failure, FIFO or standard |
| SNS | Simple Notification Service — pub/sub messaging | Fan-out: one message to email, SMS, SQS, Lambda |
| ElastiCache | Managed Redis or Memcached | Cache DB queries, sessions, real-time leaderboards |
| Secrets Manager | Store and auto-rotate credentials | RDS passwords, API keys — never hardcode credentials |
| CloudWatch | Metrics, logs, alarms, dashboards | Monitor everything — set alarms for all critical metrics |
| CloudTrail | API audit log — all AWS calls | Enable in all regions — required for compliance |
# AWS CLI — Essential Commands
# Setup: pip install awscli && aws configure
# ── EC2 ──────────────────────────────────────────────────────
# Launch Ubuntu instance
aws ec2 run-instances \
--image-id $(aws ec2 describe-images \
--owners 099720109477 \
--filters "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-*22.04*amd64*" \
--query 'sort_by(Images,&CreationDate)[-1].ImageId' --output text) \
--instance-type t3.micro \
--key-name MyKeyPair \
--security-group-ids sg-xxxxxxxx \
--subnet-id subnet-xxxxxxxx \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=WebServer}]'
# List, stop, start, terminate
aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId,State.Name,PublicIpAddress,Tags[?Key==`Name`].Value|[0]]' --output table
aws ec2 stop-instances --instance-ids i-xxxxxxxxxxxxxxxxx
aws ec2 start-instances --instance-ids i-xxxxxxxxxxxxxxxxx
aws ec2 terminate-instances --instance-ids i-xxxxxxxxxxxxxxxxx
# ── S3 ───────────────────────────────────────────────────────
aws s3 mb s3://mywebuniversity-$(date +%s)
aws s3 cp index.html s3://mybucket/
aws s3 sync ./html/ s3://mybucket/ --delete
aws s3 ls s3://mybucket/ --recursive --human-readable
aws s3 rm s3://mybucket/old-file.html
# Static website hosting
aws s3 website s3://mybucket --index-document index.html
aws s3api put-bucket-policy --bucket mybucket --policy '{
"Version":"2012-10-17",
"Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::mybucket/*"}]}'
# ── RDS ──────────────────────────────────────────────────────
aws rds create-db-instance \
--db-instance-identifier mywebuniversity-db \
--db-instance-class db.t3.micro \
--engine postgres \
--master-username admin \
--master-user-password SecurePass123! \
--allocated-storage 20 \
--vpc-security-group-ids sg-xxxxxxxx \
--backup-retention-period 7 \
--multi-az \
--no-publicly-accessible
aws rds describe-db-instances --query 'DBInstances[].[DBInstanceIdentifier,DBInstanceStatus,Endpoint.Address]' --output table
# ── Lambda ───────────────────────────────────────────────────
zip function.zip lambda_function.py
aws lambda create-function \
--function-name mywebuniversity-api \
--runtime python3.12 \
--role arn:aws:iam::123456789012:role/lambda-role \
--handler lambda_function.lambda_handler \
--zip-file fileb://function.zip \
--timeout 30 --memory-size 256
aws lambda invoke \
--function-name mywebuniversity-api \
--payload '{"path":"/courses"}' \
--cli-binary-format raw-in-base64-out response.json
cat response.json
# ── IAM ──────────────────────────────────────────────────────
aws iam create-role --role-name LambdaExecutionRole \
--assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"},"Action":"sts:AssumeRole"}]}'
aws iam attach-role-policy --role-name LambdaExecutionRole \
--policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
# ── CloudFormation ────────────────────────────────────────────
aws cloudformation deploy \
--template-file template.yaml \
--stack-name mywebuniversity \
--capabilities CAPABILITY_IAM \
--parameter-overrides Environment=production
aws cloudformation describe-stacks --stack-name mywebuniversity