Cloud compute ranges from full VMs to serverless functions. Storage includes object storage (S3/Blob), block storage (EBS/Managed Disks), and file storage (EFS/Azure Files). Choosing the right storage type is critical for performance and cost.
| Term / Service | Description / Value | Notes |
|---|---|---|
| Virtual Machine | EC2 (AWS) / Azure VM / GCE (GCP) | Full OS on dedicated or shared hardware |
| Instance type | t3.micro / m5.large / c5.xlarge | Family (t=burstable,m=general,c=compute) + size |
| AMI / Image | Amazon Machine Image / VM Image | OS snapshot used to launch instances |
| Spot Instance | Up to 90% off — interruptible VMs | Cheapest option — workloads must tolerate interruption |
| Reserved Instance | 1-3 year commitment — up to 75% off | Predictable workloads with steady usage |
| On-Demand | Pay per second/hour — no commitment | Default — flexible but most expensive |
| Savings Plans | Flexible commitment discount | Commit to $/hour spend, not specific instance types |
| Serverless / Lambda | Run code without managing servers | Event-driven: API call, S3 upload, schedule, queue |
| Lambda limits | 15 min timeout, 10GB memory, 250MB code | Know the limits for serverless design |
| Container | Lightweight portable runtime (Docker) | See Chapter 40 for full container reference |
| Fargate | Serverless containers — no EC2 management | ECS/EKS task runs without managing servers |
| Object Storage | S3 (AWS) / Azure Blob / GCS | Flat namespace, HTTP API, unlimited scale, cheap |
| S3 bucket | Named container for objects — globally unique name | Objects: key + value + metadata |
| S3 storage class | Standard / IA / Glacier / Deep Archive | Tradeoff between access speed and cost |
| S3 lifecycle | Automatically move objects to cheaper storage classes | e.g., move to IA after 30 days, Glacier after 90 |
| Block Storage | EBS (AWS) / Azure Managed Disk / Persistent Disk | Attached to one VM — like a hard drive |
| EBS volume type | gp3 (general) / io2 (high IOPS) / st1 (throughput) | Choose based on workload IOPS and throughput needs |
| EBS snapshot | Point-in-time backup of EBS volume | Stored in S3, used to create AMIs or restore volumes |
| File Storage | EFS (AWS) / Azure Files / Filestore (GCP) | Shared NFS/SMB filesystem — mount on multiple VMs |
| Database managed | RDS / Azure DB / Cloud SQL | Managed relational DB — backups, patches, HA included |
| NoSQL managed | DynamoDB / Cosmos DB / Firestore | Managed NoSQL — serverless, auto-scale |
| Cache | ElastiCache (Redis/Memcached) / Azure Cache | In-memory cache layer between app and database |
| CDN | CloudFront / Azure CDN / Cloud CDN | Cache static content at edge — lower latency globally |
| Storage gateway | AWS Storage Gateway / Azure StorSimple | Hybrid: on-prem access to cloud storage |
# Cloud Compute & Storage — AWS CLI examples
# Install: pip install awscli / brew install awscli
# Configure: aws configure (enter access key, secret, region)
# ── EC2 (Virtual Machines) ────────────────────────────────────
# Launch instance
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t3.micro \
--key-name MyKeyPair \
--security-group-ids sg-12345678 \
--subnet-id subnet-12345678 \
--count 1 \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=WebServer}]'
# List running instances
aws ec2 describe-instances \
--filters "Name=instance-state-name,Values=running" \
--query 'Reservations[].Instances[].[InstanceId,PublicIpAddress,Tags[?Key==`Name`].Value|[0]]' \
--output table
# Stop / start / terminate
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
aws ec2 start-instances --instance-ids i-1234567890abcdef0
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0
# ── S3 (Object Storage) ───────────────────────────────────────
# Create bucket
aws s3 mb s3://mywebuniversity-content --region us-east-1
# Upload file/folder
aws s3 cp local-file.html s3://mywebuniversity-content/
aws s3 sync ./html/ s3://mywebuniversity-content/ --delete
# Download
aws s3 cp s3://mywebuniversity-content/file.html ./
aws s3 sync s3://mywebuniversity-content/ ./local-copy/
# List objects
aws s3 ls s3://mywebuniversity-content/
aws s3 ls s3://mywebuniversity-content/ --recursive --human-readable
# Set public read (static website hosting)
aws s3 website s3://mywebuniversity-content/ \
--index-document index.html --error-document error.html
# Lifecycle rule — move to Glacier after 90 days
aws s3api put-bucket-lifecycle-configuration \
--bucket mywebuniversity-content \
--lifecycle-configuration '{
"Rules": [{
"ID": "MoveToGlacier",
"Status": "Enabled",
"Filter": {"Prefix": "logs/"},
"Transitions": [{"Days": 90, "StorageClass": "GLACIER"}],
"Expiration": {"Days": 365}
}]
}'
# ── Lambda (Serverless) ───────────────────────────────────────
# Package function
zip function.zip lambda_function.py
# Create function
aws lambda create-function \
--function-name MyWebUniversityAPI \
--runtime python3.12 \
--role arn:aws:iam::123456789012:role/lambda-execution-role \
--handler lambda_function.lambda_handler \
--zip-file fileb://function.zip \
--timeout 30 \
--memory-size 256
# Invoke function
aws lambda invoke \
--function-name MyWebUniversityAPI \
--payload '{"path":"/courses","method":"GET"}' \
--cli-binary-format raw-in-base64-out \
response.json && cat response.json
# Lambda function template
cat > lambda_function.py << 'LAMBDA'
import json
def lambda_handler(event, context):
print(f"Event: {json.dumps(event)}")
return {
'statusCode': 200,
'headers': {'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'},
'body': json.dumps({
'message': 'Hello from MyWebUniversity Lambda!',
'path': event.get('path', '/'),
'method': event.get('httpMethod', 'GET'),
})
}
LAMBDA