Introduction: AWS Core Services Foundation
Amazon Web Services offers hundreds of cloud services, but five form the backbone of most cloud architectures: EC2 for compute, S3 for storage, RDS for managed databases, Lambda for serverless functions, and VPC for networking. Mastering these services provides the foundation for building scalable, reliable, and cost-effective cloud applications.
EC2 (Elastic Compute Cloud): Virtual Servers in the Cloud
EC2 Key Concepts
| Concept | Description |
|---|---|
| Instance | Virtual server in the cloud |
| AMI | Amazon Machine Image – template for instances |
| Instance Type | Hardware configuration (CPU, memory, storage, networking) |
| Security Group | Virtual firewall controlling traffic to instances |
| EBS | Elastic Block Store – persistent block storage for instances |
| Key Pair | Secure login information for instances |
| User Data | Script that runs when an instance first boots |
| Instance Profile | Container for IAM role attached to EC2 instance |
EC2 Instance Types
| Family | Optimized For | Use Cases |
|---|---|---|
| T (t3, t4g) | Burstable performance | Dev/test, small web servers, microservices |
| M (m5, m6g) | Balanced | Small/medium databases, data processing |
| C (c5, c6g) | Compute | High-performance web servers, batch processing |
| R (r5, r6g) | Memory | In-memory databases, real-time analytics |
| I (i3, i4i) | Storage | NoSQL databases, data warehousing |
| G (g4, g5) | GPU | Machine learning, video rendering |
| X (x1, x2) | Memory-intensive | SAP HANA, big data processing |
| Graviton (suffix ‘g’) | ARM-based, cost-effective | General purpose workloads |
EC2 Pricing Models
| Model | Payment | Discount | Best For |
|---|---|---|---|
| On-Demand | Pay by second/hour | None | Variable workloads, short-term |
| Reserved Instances | 1 or 3-year commitment | Up to 72% | Steady-state workloads |
| Savings Plans | 1 or 3-year commitment | Up to 72% | Flexible usage across instance types |
| Spot Instances | Bid on unused capacity | Up to 90% | Fault-tolerant, flexible workloads |
| Dedicated Hosts | Physical server with EC2 capacity | None | Compliance, licensing requirements |
EC2 Command Reference
# Launch a new instance
aws ec2 run-instances --image-id ami-12345678 --instance-type t2.micro --key-name MyKeyPair
# Describe instances
aws ec2 describe-instances
# Stop an instance
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
# Start an instance
aws ec2 start-instances --instance-ids i-1234567890abcdef0
# Terminate an instance
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0
EC2 Best Practices
- Use the latest generation of instance types for better price/performance
- Implement auto-scaling groups to handle variable workloads
- Use EC2 User Data for bootstrap configuration
- Apply proper tags for resource management and cost allocation
- Use instance profiles instead of storing credentials
- Regularly back up EBS volumes with snapshots
- Implement proper security groups and NACLs
S3 (Simple Storage Service): Scalable Object Storage
S3 Key Concepts
| Concept | Description |
|---|---|
| Bucket | Container for objects stored in S3 |
| Object | File and any metadata that describes the file |
| Key | Unique identifier for an object within a bucket |
| Storage Class | Tier that determines availability, durability, and cost |
| Bucket Policy | Resource-based policies for access control |
| Lifecycle Rules | Automated object management over time |
| Versioning | Keep multiple versions of an object |
| Transfer Acceleration | Fast, secure file transfers over long distances |
| Event Notifications | Trigger workflows when objects are created/modified |
S3 Storage Classes
| Storage Class | Availability | Retrieval Time | Min Storage Duration | Use Case |
|---|---|---|---|---|
| Standard | 99.99% | Milliseconds | None | Frequently accessed data |
| Intelligent-Tiering | 99.9% | Milliseconds | None | Unknown or changing access patterns |
| Standard-IA | 99.9% | Milliseconds | 30 days | Infrequently accessed data |
| One Zone-IA | 99.5% | Milliseconds | 30 days | Infrequently accessed, non-critical data |
| Glacier Instant | 99.9% | Milliseconds to minutes | 90 days | Long-term data with occasional access |
| Glacier Flexible | 99.99% | Minutes to hours | 90 days | Archive data rarely accessed |
| Glacier Deep Archive | 99.99% | Hours | 180 days | Long-term archival, rarely accessed |
S3 Command Reference
# Create a bucket
aws s3 mb s3://mybucket
# List buckets
aws s3 ls
# Upload file to bucket
aws s3 cp myfile.txt s3://mybucket/
# Download file from bucket
aws s3 cp s3://mybucket/myfile.txt .
# Sync local directory with bucket
aws s3 sync myfolder s3://mybucket/myfolder
# List objects in bucket
aws s3 ls s3://mybucket
# Delete object from bucket
aws s3 rm s3://mybucket/myfile.txt
# Delete bucket
aws s3 rb s3://mybucket --force
S3 Best Practices
- Use bucket policies and IAM policies for access control
- Enable versioning for critical data
- Implement lifecycle rules to move data between storage classes
- Use S3 Transfer Acceleration for large file uploads
- Enable server-side encryption for sensitive data
- Use S3 Event Notifications to trigger workflows
- Implement S3 Access Points for complex permissions
- Use S3 Object Lock for WORM (Write Once Read Many) compliance
RDS (Relational Database Service): Managed Relational Databases
RDS Key Concepts
| Concept | Description |
|---|---|
| DB Instance | Database environment in the cloud |
| DB Engine | Database software (MySQL, PostgreSQL, etc.) |
| DB Parameter Group | Engine configuration values |
| DB Option Group | Optional features available for DB engine |
| Multi-AZ Deployment | Synchronous standby replica in different AZ |
| Read Replica | Asynchronous copy for read scaling |
| Automated Backup | Daily full backup with transaction logs |
| Point-in-Time Recovery | Restore to any point within retention period |
| Enhanced Monitoring | Real-time metrics for OS processes |
RDS Database Engines
| Engine | Version Range | Use Cases |
|---|---|---|
| MySQL | 5.7, 8.0 | Web applications, e-commerce |
| PostgreSQL | 10.x to 16.x | Complex queries, JSONB data |
| MariaDB | 10.3 to 10.11 | MySQL replacement, improved performance |
| Oracle | 12c, 19c, 21c | Enterprise applications, Oracle migrations |
| SQL Server | 2016, 2017, 2019, 2022 | Microsoft application stacks |
| Aurora | MySQL/PostgreSQL compatible | High performance, auto-scaling storage |
RDS Instance Types
| Family | Optimized For | Best For |
|---|---|---|
| db.t3, db.t4g | Burstable performance | Dev/test environments |
| db.m5, db.m6g | Balanced | Small-medium production databases |
| db.r5, db.r6g | Memory | In-memory processing, large databases |
| db.x1, db.x2 | Memory-intensive | High-performance databases |
RDS Command Reference
# Create DB instance
aws rds create-db-instance --db-instance-identifier mydb --db-instance-class db.t3.micro \
--engine mysql --master-username admin --master-user-password password \
--allocated-storage 20
# Describe DB instances
aws rds describe-db-instances
# Create DB snapshot
aws rds create-db-snapshot --db-instance-identifier mydb --db-snapshot-identifier mydb-snapshot
# Restore from snapshot
aws rds restore-db-instance-from-db-snapshot --db-instance-identifier mynewdb \
--db-snapshot-identifier mydb-snapshot
# Delete DB instance
aws rds delete-db-instance --db-instance-identifier mydb --skip-final-snapshot
RDS Best Practices
- Use Multi-AZ deployments for high availability
- Deploy read replicas for read scaling and reporting
- Implement automated backups with appropriate retention
- Use parameter groups to optimize database configuration
- Monitor performance with Enhanced Monitoring and Performance Insights
- Create maintenance windows during low-traffic periods
- Use IAM authentication for database access
- Right-size instances based on workload characteristics
Lambda: Serverless Computing
Lambda Key Concepts
| Concept | Description |
|---|---|
| Function | Code executed in response to events |
| Event Source | AWS service or custom application that triggers function |
| Runtime | Language environment (Node.js, Python, Java, etc.) |
| Handler | Method that processes events |
| Execution Context | Environment where function runs |
| Cold Start | Initial setup time when new execution environment is created |
| Concurrency | Number of function instances running simultaneously |
| Layer | ZIP archives containing libraries, custom runtime, etc. |
| Destination | Target for success/failure of asynchronous invocations |
Lambda Limits & Quotas
| Resource | Limit |
|---|---|
| Maximum memory allocation | 10,240 MB |
| Function timeout | 15 minutes |
| Deployment package size | 50 MB (zipped), 250 MB (unzipped) |
| Environment variables | 4 KB |
| Concurrent executions | 1,000 (default, can be increased) |
| Payload size | 6 MB (synchronous), 256 KB (asynchronous) |
| Temporary disk capacity | 512 MB to 10,240 MB (matching memory) |
Lambda Supported Runtimes
| Runtime | Versions |
|---|---|
| Node.js | 18.x, 20.x |
| Python | 3.9, 3.10, 3.11, 3.12 |
| Java | 8, 11, 17, 21 |
| Ruby | 3.2, 3.3 |
| Go | 1.x |
| .NET Core | 6.0, 8.0 |
| Custom Runtime | Provided.al2 |
Lambda Command Reference
# Create function
aws lambda create-function --function-name my-function \
--zip-file fileb://my-function.zip --handler index.handler \
--runtime nodejs20.x --role arn:aws:iam::123456789012:role/lambda-role
# Invoke function
aws lambda invoke --function-name my-function \
--payload '{"key":"value"}' response.json
# Update function code
aws lambda update-function-code --function-name my-function \
--zip-file fileb://my-function-updated.zip
# Configure function
aws lambda update-function-configuration --function-name my-function \
--timeout 30 --memory-size 256
# Delete function
aws lambda delete-function --function-name my-function
Lambda Best Practices
- Keep functions focused on a single task
- Initialize SDK clients and database connections outside handler
- Use environment variables for configuration
- Implement proper error handling and logging
- Set appropriate memory allocation for performance
- Use Provisioned Concurrency for latency-sensitive applications
- Leverage Lambda Layers for code reuse
- Implement dead-letter queues for failed event processing
- Use AWS X-Ray for tracing and debugging
VPC (Virtual Private Cloud): Isolated Network Infrastructure
VPC Key Concepts
| Concept | Description |
|---|---|
| VPC | Logically isolated section of AWS cloud |
| Subnet | Range of IP addresses in VPC |
| Route Table | Rules determining network traffic direction |
| Internet Gateway | Enables communication between VPC and internet |
| NAT Gateway | Enables private subnet resources to access internet |
| Security Group | Virtual firewall for instances (stateful) |
| Network ACL | Access control list for subnets (stateless) |
| VPC Peering | Connection between two VPCs |
| VPC Endpoint | Private connection to supported AWS services |
| Flow Logs | Capture network traffic information |
VPC Subnet Types
| Type | Internet Access | Use Cases |
|---|---|---|
| Public Subnet | Direct via Internet Gateway | Web servers, load balancers |
| Private Subnet | Via NAT Gateway | Application servers, databases |
| Isolated Subnet | No internet access | Highly secured databases, regulated workloads |
VPC CIDR Blocks & IP Addressing
| VPC Size | CIDR Block | Available IP Addresses |
|---|---|---|
| Small | /24 | 251 usable IPs (256 – 5 reserved) |
| Medium | /20 | 4,091 usable IPs (4,096 – 5 reserved) |
| Large | /16 | 65,531 usable IPs (65,536 – 5 reserved) |
Note: AWS reserves the first 4 IP addresses and the last IP address in each subnet CIDR block.
VPC Command Reference
# Create VPC
aws ec2 create-vpc --cidr-block 10.0.0.0/16
# Create subnet
aws ec2 create-subnet --vpc-id vpc-1234567890abcdef0 \
--cidr-block 10.0.1.0/24 --availability-zone us-west-2a
# Create internet gateway
aws ec2 create-internet-gateway
# Attach internet gateway to VPC
aws ec2 attach-internet-gateway --internet-gateway-id igw-1234567890abcdef0 \
--vpc-id vpc-1234567890abcdef0
# Create route table
aws ec2 create-route-table --vpc-id vpc-1234567890abcdef0
# Create route to internet
aws ec2 create-route --route-table-id rtb-1234567890abcdef0 \
--destination-cidr-block 0.0.0.0/0 --gateway-id igw-1234567890abcdef0
# Associate route table with subnet
aws ec2 associate-route-table --route-table-id rtb-1234567890abcdef0 \
--subnet-id subnet-1234567890abcdef0
VPC Best Practices
- Design VPC CIDR for future growth
- Create subnets across multiple Availability Zones
- Use private subnets for all non-public-facing resources
- Implement security groups and NACLs in layers
- Use VPC endpoints for private access to AWS services
- Enable VPC Flow Logs for network monitoring
- Use Transit Gateway for complex networking
- Implement proper IP address management
- Use Network Firewall for advanced security
Cross-Service Integration Patterns
Storage Integration
| Service Combination | Integration | Use Case |
|---|---|---|
| EC2 + EBS | Block storage for instances | Databases, applications requiring low-latency storage |
| EC2 + S3 | Object storage access | Media processing, backups, static content |
| Lambda + S3 | Event-driven processing | Image resizing, document processing, ETL workflows |
| RDS + S3 | Database backups | Export/import of database data |
Compute Integration
| Service Combination | Integration | Use Case |
|---|---|---|
| EC2 + Lambda | Microservices architecture | Hybrid processing architectures |
| EC2 + Auto Scaling + Load Balancer | Scalable applications | Web applications, API servers |
| Lambda + API Gateway | Serverless API | Microservices, mobile backends |
| Lambda + Step Functions | Workflow orchestration | Complex business processes, ETL workflows |
Database Integration
| Service Combination | Integration | Use Case |
|---|---|---|
| EC2 + RDS | Application + database tier | Traditional web applications |
| Lambda + RDS | Serverless database access | Automated database operations, data APIs |
| RDS + Read Replicas | Read scaling | High-read applications, reporting |
| Aurora Serverless + Lambda | On-demand database | Infrequently used applications |
Networking Integration
| Service Combination | Integration | Use Case |
|---|---|---|
| VPC + EC2 + Load Balancer | High-availability deployment | Multi-tier applications |
| VPC + VPC Peering | Multi-VPC architecture | Organizational resource sharing |
| VPC Endpoints + S3/DynamoDB | Private AWS service access | Enhanced security for data access |
| VPC + Transit Gateway | Hub-and-spoke network | Enterprise network integration |
Common Design Patterns & Architectures
Three-Tier Web Application
Web Tier (Public Subnet)
- EC2 instances behind load balancer
- Auto Scaling Group for scalability
- Security Group allowing HTTP/HTTPS
Application Tier (Private Subnet)
- EC2 instances with application code
- Auto Scaling Group for scalability
- Security Group allowing specific ports from web tier
Database Tier (Private Subnet)
- RDS instance with Multi-AZ
- Security Group allowing only application tier access
Serverless Web Application
Front-end
- S3 for static website hosting
- CloudFront for content delivery
API Layer
- API Gateway for request management
- Lambda functions for business logic
- IAM roles for access control
Data Layer
- DynamoDB for NoSQL data storage
- S3 for object storage
- RDS (Aurora Serverless) for relational data
Hybrid Architecture
On-premises Connection
- Direct Connect or Site-to-Site VPN
- Transit Gateway for network routing
AWS Resources
- VPC with private subnets
- EC2 instances for compute
- S3 for storage
Data Synchronization
- Database replication
- S3 Transfer Acceleration
AWS Exam & Certification Tips
EC2 Focus Areas
- Instance types and families
- Instance purchasing options
- AMI selection and management
- Storage options (EBS vs Instance Store)
- Security groups vs NACLs
- Placement groups
S3 Focus Areas
- Storage classes and transitions
- Bucket policies and ACLs
- Encryption options
- Static website hosting
- Versioning and lifecycle policies
- Cross-region replication
RDS Focus Areas
- Database engine features
- Multi-AZ vs Read Replicas
- Backup and restore options
- Security and encryption
- Parameter and option groups
- Monitoring and metrics
Lambda Focus Areas
- Event sources and triggers
- Function configuration
- Cold start behavior
- Concurrency management
- Security and permissions
- Monitoring and troubleshooting
VPC Focus Areas
- CIDR blocks and subnetting
- Routing and internet access
- Security groups vs NACLs
- VPC endpoints and PrivateLink
- VPC peering and Transit Gateway
- NAT gateway vs NAT instance
Resources for Further Learning
Official AWS Documentation
- Amazon EC2 Documentation
- Amazon S3 Documentation
- Amazon RDS Documentation
- AWS Lambda Documentation
- Amazon VPC Documentation
AWS Whitepapers
- AWS Well-Architected Framework
- AWS Security Best Practices
- AWS Storage Services Overview
- Serverless Applications Lens
