Cheat Sheet: Compute

1. EC2 Instance Types and Families

1.1 Instance Family Categories

1.1 Instance Family Categories

1.2 Burstable Performance Instances

  • T3/T3a/T4g: Accumulate CPU credits when below baseline, consume when bursting
  • Unlimited mode: Can burst beyond credits for additional cost
  • Use for workloads with variable CPU usage patterns

1.3 Placement Groups

1.3 Placement Groups

2. EC2 Purchasing Options

2.1 Pricing Models Comparison

2.1 Pricing Models Comparison

2.2 Spot Instance Strategies

  • Spot Fleet: Collection of Spot and On-Demand instances; can define multiple launch pools with different instance types and AZs
  • Allocation strategies: lowestPrice, diversified, capacityOptimized, priceCapacityOptimized
  • Spot Block: Request Spot instances for 1-6 hours without interruption (deprecated, use EC2 Fleet instead)
  • EC2 Fleet: Provision mix of instance types and purchase options in single request; supports multi-AZ

3. Auto Scaling

3.1 Auto Scaling Components

3.1 Auto Scaling Components

3.2 Scaling Policy Types

3.2 Scaling Policy Types

3.3 Auto Scaling Configuration

  • Default termination policy: Oldest launch template → oldest launch configuration → closest to next billing hour → random
  • Cooldown period: Default 300 seconds; prevents ASG from launching/terminating before previous scaling takes effect
  • Health checks: EC2 (instance status), ELB (target health); grace period before first health check (default 300 seconds)
  • Lifecycle hooks: Perform actions before instance launch (Pending:Wait) or termination (Terminating:Wait); max timeout 7200 seconds
  • Warm pools: Pre-initialized instances in Stopped or Hibernated state; faster scaling response

3.4 Multi-AZ and Load Balancer Integration

  • ASG automatically distributes instances across multiple AZs for high availability
  • Rebalancing: ASG launches new instances before terminating old ones in over-provisioned AZs
  • Integration with ALB/NLB/CLB: ASG registers instances with load balancer target groups automatically
  • Connection draining: ALB/NLB deregistration delay (default 300 seconds) before instance termination

4. Elastic Load Balancing

4.1 Load Balancer Types Comparison

4.1 Load Balancer Types Comparison 4.1 Load Balancer Types Comparison 4.1 Load Balancer Types Comparison

4.2 ALB Advanced Features

  • Content-based routing: Route to different target groups based on URL path, hostname, headers, query strings
  • Host-based routing: Multiple domains on single ALB using host conditions
  • Weighted target groups: A/B testing and blue/green deployments with traffic distribution control
  • Fixed response: Return custom HTTP response directly from ALB without forwarding to target
  • Redirect rules: HTTP to HTTPS, domain redirects at ALB level
  • SNI: Multiple TLS certificates on single ALB; serves correct certificate based on hostname
  • Request tracing: X-Amzn-Trace-Id header for end-to-end request tracking

4.3 Cross-Zone Load Balancing

4.3 Cross-Zone Load Balancing

4.4 Connection and Request Handling

  • Connection draining (CLB) / Deregistration delay (ALB/NLB): 1-3600 seconds (default 300); completes in-flight requests before deregistering target
  • Idle timeout: ALB default 60 seconds; client and target must send data within timeout to keep connection open
  • Health checks: Configurable interval (5-300 seconds), timeout (2-120 seconds), healthy/unhealthy thresholds
  • Target types: instance (route by instance ID), ip (route to IP including on-premises), lambda (invoke function)

5. Container Services

5.1 ECS Launch Types

5.1 ECS Launch Types

5.2 ECS Core Components

5.2 ECS Core Components

5.3 ECS Task Placement

5.3.1 Placement Strategies (EC2 Launch Type)

  • Binpack: Minimize number of instances by placing tasks based on least available CPU or memory
  • Random: Place tasks randomly across instances
  • Spread: Distribute tasks evenly based on specified field (instance ID, AZ, custom attribute)
  • Can combine multiple strategies in order of execution

5.3.2 Placement Constraints (EC2 Launch Type)

  • distinctInstance: Each task on different instance
  • memberOf: Tasks placed on instances satisfying expression (cluster query language)

5.4 ECS Networking

5.4 ECS Networking

5.5 ECS Service Auto Scaling

  • Target Tracking: Scale based on CloudWatch metric (CPU, memory, ALB request count)
  • Step Scaling: Scale based on CloudWatch alarms with step adjustments
  • Scheduled Scaling: Time-based scaling for predictable patterns
  • ECS Cluster Capacity Provider: Automatically scale EC2 instances for EC2 launch type using ASG
  • Fargate: Scales tasks automatically; no infrastructure scaling needed

5.6 EKS Architecture

  • Managed Kubernetes control plane across multiple AZs; automatic version upgrades and patching
  • Node types: Managed node groups (EC2 automated), self-managed nodes (full control), Fargate (serverless)
  • IAM integration: IAM roles for service accounts (IRSA) using OIDC provider; pod-level IAM permissions
  • Networking: VPC CNI plugin assigns VPC IP addresses to pods; supports security groups for pods
  • Storage: EBS CSI driver for persistent volumes; EFS CSI driver for shared storage

5.7 ECS vs EKS Decision Factors

5.7 ECS vs EKS Decision Factors

6. Serverless Compute

6.1 Lambda Configuration

6.1 Lambda Configuration

6.2 Lambda Invocation Models

6.2 Lambda Invocation Models

6.3 Lambda Integrations

  • VPC: Lambda functions can access VPC resources; requires subnet and security group configuration; uses Hyperplane ENI (scalable)
  • RDS Proxy: Connection pooling for RDS; reduces connection overhead; improves scalability with Lambda
  • EFS: Mount file system for persistent storage across invocations; requires VPC configuration
  • Layers: Share code, libraries, dependencies across functions; max 5 layers per function; 250 MB total unzipped size
  • Extensions: Integrate monitoring, observability, security tools; run in Lambda execution environment

6.4 Lambda Performance Optimization

  • Provisioned Concurrency: Pre-initialized execution environments; eliminates cold starts; predictable performance
  • Cold start factors: Runtime choice (compiled languages faster), VPC configuration (Hyperplane ENI reduces impact), package size
  • Memory allocation: More memory = more CPU; test optimal memory for cost-performance balance
  • Lambda SnapStart (Java): Reduces cold start latency by caching initialized snapshot
  • Function reuse: Leverage execution context reuse; initialize SDK clients outside handler; cache in /tmp

6.5 Lambda Scaling and Throttling

  • Scaling: Automatic up to account concurrency limit; up to 1,000 concurrent executions per region by default
  • Burst limits: 3,000 (US West, US East, Europe), 1,000 (other regions), 500 (specific regions) concurrent executions per minute increase
  • Reserved concurrency: Guarantees concurrency for function; limits maximum concurrency; prevents function from using unreserved pool
  • Throttling: Returns 429 TooManyRequestsException; synchronous invocations return error to caller; asynchronous retry automatically

6.6 Step Functions

  • Orchestrate Lambda functions and AWS services into workflows; visual workflow designer
  • State types: Task, Choice, Parallel, Wait, Succeed, Fail, Pass, Map
  • Standard workflows: Up to 1 year execution; exactly-once execution; full execution history; higher cost
  • Express workflows: Up to 5 minutes; at-least-once execution; CloudWatch Logs for history; high-volume event processing; lower cost
  • Error handling: Retry with exponential backoff; Catch for error transitions; built-in fault tolerance
  • Integration: Direct SDK integrations with 200+ AWS services; optimized integrations for 9 services including Lambda, ECS, SNS, SQS, Glue, SageMaker, EMR, Batch, DynamoDB

7. Batch Processing

7.1 AWS Batch Components

7.1 AWS Batch Components

7.2 AWS Batch Features

  • Managed compute: Automatically provisions optimal compute resources based on job requirements
  • Spot integration: Use Spot instances for cost savings; automatically replaces interrupted instances
  • Multi-node parallel jobs: Tightly coupled workloads across multiple EC2 instances
  • Array jobs: Submit large number of similar jobs with single submission; child jobs inherit parent parameters
  • Job dependencies: Sequential, N_TO_N dependencies between jobs
  • Scheduling: Fair share scheduling with policies; priority-based queue selection

7.3 Batch vs Lambda Decision

7.3 Batch vs Lambda Decision

8. Additional Compute Services

8.1 Lightsail

  • Simplified compute service with fixed monthly pricing; includes VM, SSD storage, data transfer, DNS management, static IP
  • Pre-configured application stacks: WordPress, LAMP, Node.js, MEAN, Magento
  • Use cases: Simple web applications, dev/test environments, small business workloads
  • Limited scalability compared to EC2; cannot use advanced AWS features

8.2 Elastic Beanstalk

  • PaaS for deploying applications; handles provisioning, load balancing, auto scaling, monitoring
  • Platforms: Java, .NET, PHP, Node.js, Python, Ruby, Go, Docker
  • Deployment policies: All at once, Rolling, Rolling with additional batch, Immutable, Blue/Green, Traffic splitting
  • Full control: Access underlying resources (EC2, RDS, ALB); customize via .ebextensions configuration files
  • Free service; pay only for underlying resources

8.3 Outposts

  • Fully managed on-premises AWS infrastructure; extends VPC to on-premises
  • Compute options: EC2 instances, ECS, EKS; consistent APIs and tools with AWS Regions
  • Form factors: 42U racks, 1U and 2U servers
  • Use cases: Low latency, local data processing, data residency requirements, hybrid cloud
  • Local services: EBS, S3, RDS, EMR; connects to Region via service link

8.4 Wavelength

  • Embeds AWS compute and storage within 5G networks at telecommunication carrier data centers
  • Ultra-low latency: Single-digit millisecond latency to mobile devices and end users
  • Services: EC2 instances, EBS, VPC; extends VPC into Wavelength Zone
  • Use cases: ML inference at edge, AR/VR, real-time gaming, live video streaming

8.5 Local Zones

  • AWS infrastructure closer to large population centers; extension of Region
  • Lower latency than Region: Single-digit millisecond latency for end users
  • Services: EC2, EBS, VPC, ECS, EKS, ALB, FSx
  • Enable via opt-in; subnet in Local Zone connected to VPC in parent Region
  • Use cases: Latency-sensitive applications, media rendering, real-time gaming

8.6 ParallelCluster

  • Open-source cluster management tool for HPC on AWS
  • Automates creation of VPC, subnet, compute fleet, shared file system
  • Integrations: Slurm, AWS Batch as schedulers; FSx for Lustre, EFS for storage
  • Supports multiple instance types, Spot instances, elastic scaling
  • Configuration via YAML file; deploy via CLI or CloudFormation

8.7 App Runner

  • Fully managed container and web application service; deploys from source code or container image
  • Automatic scaling, load balancing, encryption; pay per use based on compute and memory
  • Source: GitHub, Bitbucket, ECR; automatic deployments on code changes
  • Use cases: Web applications, APIs, microservices without infrastructure management
  • Simpler than ECS/EKS; less control but faster deployment

9. Compute Architecture Patterns

9.1 High Availability Patterns

  • Multi-AZ: Deploy instances across at least 2 AZs; use Auto Scaling Groups with cross-zone load balancing
  • Multi-Region: Active-active or active-passive; Route 53 health checks and routing policies; cross-region replication for data
  • Stateless applications: Store session data in ElastiCache, DynamoDB; enables horizontal scaling
  • Health checks: ELB target health, Route 53 endpoint health, ASG instance health; define appropriate grace periods

9.2 Scaling Patterns

  • Vertical scaling: Increase instance size; requires downtime; limited by instance family maximum
  • Horizontal scaling: Add more instances; no downtime with load balancer; preferred for cloud-native applications
  • Scheduled scaling: Pre-scale for known traffic patterns; combine with dynamic scaling
  • Predictive scaling: ML-based forecasting for proactive scaling; analyzes historical patterns

9.3 Cost Optimization Strategies

  • Right-sizing: Use CloudWatch metrics to identify underutilized instances; Compute Optimizer recommendations
  • Purchase options: Reserved Instances or Savings Plans for steady-state; Spot for fault-tolerant workloads; On-Demand for unpredictable
  • Auto Scaling: Scale in during low demand; use target tracking with appropriate metrics
  • Serverless adoption: Lambda for intermittent workloads; Fargate for containers without EC2 management overhead
  • Instance generations: Use latest generation instances for better price-performance; Graviton2/Graviton3 for 20-40% better price-performance

9.4 Hybrid and Edge Patterns

  • Outposts: Consistent AWS experience on-premises; VMware Cloud on AWS for VMware workloads
  • Storage Gateway: Bridge on-premises applications to cloud storage
  • Direct Connect: Dedicated network connection for hybrid workloads; more predictable latency than VPN
  • Wavelength: Deploy at 5G edge for mobile applications
  • Local Zones: Extend Region for latency-sensitive applications in specific metros

9.5 Migration Strategies

  • Rehost (lift and shift): VM Import/Export, Application Migration Service; minimal changes
  • Replatform: Move to managed services; RDS instead of self-managed database; Elastic Beanstalk for applications
  • Refactor: Redesign for cloud-native; containerization, serverless, microservices
  • Repurchase: Move to SaaS; replace custom applications with commercial solutions

10. Monitoring and Troubleshooting

10.1 CloudWatch Metrics

10.1 CloudWatch Metrics

10.2 Logging and Tracing

  • CloudWatch Logs: Centralized logging; EC2 requires CloudWatch agent; Lambda automatic; retention policies
  • VPC Flow Logs: Network traffic monitoring; troubleshoot connectivity; security analysis
  • ELB Access Logs: Request details stored in S3; includes timestamps, client IPs, latencies, request paths
  • X-Ray: Distributed tracing; analyze and debug microservices; service map visualization; trace sampling
  • CloudTrail: API call logging; governance, compliance, auditing; integrates with CloudWatch Logs

10.3 Common Troubleshooting Scenarios

10.3 Common Troubleshooting Scenarios

10.4 Performance Optimization

  • EC2: Use enhanced networking (ENA) for higher bandwidth and lower latency; placement groups for HPC
  • EBS: Use provisioned IOPS for consistent performance; io2 Block Express for highest performance
  • Load Balancer: Enable connection draining; configure appropriate idle timeout; use cross-zone load balancing
  • Lambda: Optimize memory allocation; reduce package size; reuse execution context; use Provisioned Concurrency for consistent latency
  • Containers: Right-size task CPU and memory; use Fargate Spot for cost-performance; implement health checks
The document Cheat Sheet: Compute is a part of the AWS Solutions Architect Course AWS Solutions Architect: Professional Level.
All you need of AWS Solutions Architect at this link: AWS Solutions Architect
Explore Courses for AWS Solutions Architect exam
Get EduRev Notes directly in your Google search
Related Searches
shortcuts and tricks, study material, Summary, past year papers, Important questions, Viva Questions, video lectures, Objective type Questions, Previous Year Questions with Solutions, Free, mock tests for examination, Cheat Sheet: Compute, Exam, practice quizzes, Cheat Sheet: Compute, pdf , ppt, Sample Paper, Extra Questions, Semester Notes, Cheat Sheet: Compute, MCQs;