Determining cost-effective AWS compute services with appropriate usecases (for example, Lambda, Amazon EC2, Fargate)

Task Statement 4.2: Design cost-optimized compute solutions.

📘AWS Certified Solutions Architect – (SAA-C03)


1. Overview: Why Choosing the Right Compute Service Matters

In AWS, compute services run your applications.

Choosing the wrong service can:

  • Increase costs
  • Reduce performance
  • Add unnecessary complexity

Choosing the right one helps you:

  • Pay only for what you use
  • Scale efficiently
  • Reduce operational work

2. Main AWS Compute Services for the Exam

You must clearly understand these three:

1. AWS Lambda (Serverless)

2. Amazon EC2 (Virtual Servers)

3. AWS Fargate (Serverless Containers)


3. AWS Lambda (Serverless Compute)

What is AWS Lambda?

AWS Lambda runs your code without managing servers.

You only upload code, and AWS handles:

  • Servers
  • Scaling
  • Maintenance

Cost Model

You pay only for:

  • Number of requests
  • Execution time (milliseconds)

No cost when idle.


Key Characteristics

  • Fully serverless
  • Automatic scaling
  • Event-driven
  • Short execution time (max 15 minutes)

When to Use (Exam Focus)

Use Lambda when:

  • Workloads are intermittent or unpredictable
  • Execution time is short
  • You want zero server management

IT-Based Use Cases

  • Processing files uploaded to S3
  • Running backend APIs using API Gateway
  • Data transformation tasks
  • Real-time log processing

Cost Optimization Benefits

  • No idle cost
  • Auto-scaling (no over-provisioning)
  • Fine-grained billing (milliseconds)

Limitations (Important for Exam)

  • Not suitable for long-running tasks
  • Limited memory and CPU
  • Cold start latency (for infrequent use)

4. Amazon EC2 (Elastic Compute Cloud)

What is EC2?

Amazon EC2 provides virtual servers where you control everything:

  • OS
  • Software
  • Scaling (manual or auto)

Cost Model

You pay for:

  • Running instances (per second/hour)
  • Storage, networking, etc.

Key Characteristics

  • Full control over environment
  • Flexible instance types
  • Supports all workloads

When to Use (Exam Focus)

Use EC2 when:

  • You need full control
  • Workloads are long-running
  • Applications require custom configuration

IT-Based Use Cases

  • Hosting web servers (e.g., Apache, Nginx)
  • Running databases (self-managed)
  • Enterprise applications
  • Legacy systems

Cost Optimization Options (VERY IMPORTANT)

To reduce cost in EC2, use:

1. Spot Instances

  • Up to 90% cheaper
  • Can be interrupted

2. Reserved Instances / Savings Plans

  • Commit for 1–3 years
  • Lower cost

3. Auto Scaling

  • Add/remove instances based on demand

Cost Optimization Benefits

  • Flexible pricing options
  • Can optimize based on workload predictability

Limitations

  • You manage servers
  • Can have idle cost
  • Requires scaling configuration

5. AWS Fargate (Serverless Containers)

What is Fargate?

AWS Fargate runs containers without managing servers.

Works with:

  • Amazon ECS
  • Amazon EKS

Cost Model

You pay for:

  • CPU and memory used per second

No cost when containers are not running.


Key Characteristics

  • Serverless container platform
  • No infrastructure management
  • Scales automatically

When to Use (Exam Focus)

Use Fargate when:

  • You are using containers
  • You want serverless compute
  • You don’t want to manage EC2 instances

IT-Based Use Cases

  • Microservices architecture
  • Containerized APIs
  • Batch processing jobs in containers

Cost Optimization Benefits

  • No need to pay for idle EC2 instances
  • Pay per task usage
  • Simplified scaling

Limitations

  • More expensive than EC2 for constant workloads
  • Less control than EC2

6. Key Comparison (VERY IMPORTANT FOR EXAM)

FeatureAWS LambdaAmazon EC2AWS Fargate
Server ManagementNoneFull controlNone
PricingPer request + durationPer instance timePer CPU & memory
Best ForShort tasks, event-drivenLong-running appsContainerized apps
ScalingAutomaticManual/Auto ScalingAutomatic
Idle CostNoneYesNone
Control LevelLowHighMedium

7. How to Choose the Most Cost-Effective Service

Step 1: Check Workload Type

Short, event-driven tasks

→ Use Lambda

Long-running applications

→ Use EC2

Container-based workloads

→ Use Fargate


Step 2: Check Usage Pattern

Spiky or unpredictable

→ Lambda or Fargate

Steady usage

→ EC2 with Reserved Instances or Savings Plans


Step 3: Check Management Requirement

Want no infrastructure management

→ Lambda or Fargate

Need full control

→ EC2


8. Exam Tips (VERY IMPORTANT)

1. Always look for keywords in questions

KeywordBest Choice
Event-drivenLambda
Short executionLambda
Full controlEC2
ContainersFargate
No server managementLambda / Fargate

2. Cost Optimization Clues

  • “Avoid paying for idle resources” → Lambda / Fargate
  • “Predictable workload” → EC2 Reserved Instances
  • “Flexible workload, interruptible” → Spot Instances

3. Common Exam Traps

  • Choosing EC2 when Lambda is cheaper for short tasks
  • Choosing Fargate when EC2 is cheaper for steady workloads
  • Ignoring Spot Instances for cost savings

9. Final Summary

  • AWS Lambda → Best for event-driven, short tasks, lowest cost for intermittent workloads
  • Amazon EC2 → Best for full control and long-running applications
  • AWS Fargate → Best for containers without managing servers

If you understand:

  • When to use each service
  • Their pricing models
  • Their scaling behavior

👉 You are fully prepared for this part of the SAA-C03 exam.

Buy Me a Coffee