Post

AWS Notes for my AWS Practitioner Certification

Notes for preparing my AWS Practitiones Exam and knowledge

AWS Notes for my AWS Practitioner Certification

AWS Cloud Computing: A Complete Guide to EC2, Containers, and Serverless

A beginner-friendly walkthrough of the core AWS concepts every developer should know — from virtual servers to serverless architecture.


What Are EC2 Instances?

EC2 (Elastic Compute Cloud) instances are virtual servers in the AWS cloud that let you run applications without owning physical hardware. You choose the operating system, compute capacity, memory, and storage based on your needs — and pay only for the time you use them.


EC2 Instance Families

🔵 General Purpose

Balanced compute, memory, and networking.

  • t4g, t3, t2 — Burstable, cost-effective for variable workloads
  • m7g, m6i, m5 — Standard workloads, web servers, small databases

🔴 Compute Optimized

High CPU performance.

  • c7g, c6i, c5 — Batch processing, game servers, HPC

🟣 Memory Optimized

Large amounts of RAM for in-memory data.

  • r7g, r6i, r5 — In-memory databases, caches, analytics
  • x2idn, x1e — SAP HANA workloads, very large databases

🟢 Accelerated Computing

GPUs for graphics and ML.

  • p4, p3 — Machine learning, model training
  • g5, g4dn — Graphics rendering, ML inference
  • inf2, trn1 — Inference and training with AWS Neuron chips

🟡 Storage Optimized

High I/O and local NVMe storage.

  • i4i, i3 — NoSQL databases, data warehouses
  • d3, h1 — Hadoop, distributed file systems

⚪ High Performance Computing (HPC)

  • hpc7g, hpc6a — Scientific simulations, fluid dynamics

Instance Naming Convention

1
2
3
4
5
m  6  i  .  xlarge
│  │  │     └─ Size
│  │  └─────── Attribute (i=Intel, g=Graviton, a=AMD)
│  └────────── Generation
└──────────────Family

Available Sizes

nanomicrosmallmediumlargexlarge2xlarge → … → 48xlarge (depending on family)


EC2 Pricing Models

AWS offers several pricing models to adapt to different usage patterns and budgets.

1. 🟢 On-Demand

Pay by the hour or second, no commitments.

  • No upfront payments or contracts
  • Ideal for unpredictable workloads or dev/test environments
  • Highest per-hour price, but maximum flexibility
  • Minimum billing of 60 seconds

When to use it: New applications, test environments, unpredictable traffic spikes.


2. 🔵 Reserved Instances (RI)

Commit to 1 or 3 years in exchange for a discount.

Payment OptionUpfrontTypical Discount
All UpfrontEverything upfrontUp to 72%
Partial UpfrontPart upfront~60%
No UpfrontMonthly only~40%
  • Standard RI: Maximum discount, less flexibility
  • Convertible RI: Can change family/type, lower discount

When to use it: Stable, predictable workloads (production, databases).


3. 🟡 Savings Plans

Similar to RI but more flexible — commitment in $/hour.

  • Compute Savings Plans: Applies to EC2, Lambda, and Fargate. Maximum flexibility.
  • EC2 Instance Savings Plans: EC2 only, higher discount (up to 72%)
  • Freely change region, family, OS, and size

When to use it: When you want RI-level discounts with more flexibility.


4. 🔴 Spot Instances

Use AWS unused capacity at discounts of up to 90%.

  • AWS can interrupt them with 2 minutes notice
  • Price fluctuates with supply and demand
  • Not suitable for critical workloads that can’t tolerate interruption

When to use it: Batch processing, rendering, ML training, fault-tolerant tasks.


5. ⚪ Dedicated Hosts

Physical server dedicated exclusively to you.

  • Compliance requirements or per-socket/core licensing (Windows, SQL Server)
  • The most expensive of all pricing models
  • Can be combined with RI to reduce costs

When to use it: Compliance regulations, BYOL (Bring Your Own License) licensing.


6. 🟣 Dedicated Instances

Instances on dedicated hardware, but without control of the physical server.

  • Hardware-level isolation from other customers
  • Less control than Dedicated Hosts, but cheaper

Pricing Model Comparison

ModelCostFlexibilityInterruption
On-DemandHighMaximumNo
ReservedLowLowNo
Savings PlansLowMediumNo
SpotVery LowMediumYes
Dedicated HostVery HighLowNo

Most companies combine models:

  • Stable base → Reserved Instances or Savings Plans
  • Traffic spikes → On-Demand
  • Batch/ML tasks → Spot Instances

Best Instance for CPU-Intensive Workloads

For CPU-intensive use, the C (Compute Optimized) family is the right choice.

🥇 c7g (Graviton 3) — Best price/performance ratio

  • AWS Graviton 3 ARM processor
  • Up to 40% better performance than c6i
  • Up to 60% cheaper than x86 equivalents
  • Ideal if your software is ARM-compatible

🥈 c6i / c6a — Top-tier x86

  • c6i: Intel Ice Lake, excellent single-thread performance
  • c6a: AMD EPYC, better price than c6i, similar performance
  • Great option if you need guaranteed x86 compatibility

🥉 c5 / c5n — Previous generation, lower cost

  • Still widely used in production
  • Good option if you’re looking to reduce costs with RI

Choosing by Use Case

Use CaseRecommended Instance
High-traffic web serversc7g or c6i
Batch processingc7g (price/performance)
Game serversc6i (low latency)
HPC / scientific simulationshpc7g or c7gn
Video encodingc6a (many cores, low price)
Maximum x86 compatibilityc6i

Does Windows Cost More?

Yes — Windows carries an additional cost on top of the base instance price.

AWS includes the Windows Server license in the hourly price, which adds a surcharge over the Linux base price.

How Much More?

The surcharge varies by instance, but generally:

  • Windows costs between 2x and 4x more than the same instance running Linux
  • The gap is larger on small instances and smaller on large ones

Approximate example with a c6i.xlarge (us-east-1):

OSApprox. Price/hour
Linux~$0.17
Windows~$0.47

Ways to Reduce Windows Costs

1. BYOL (Bring Your Own License)

  • If you already have Windows licenses with Software Assurance, you can use them on AWS
  • Requires Dedicated Hosts to be valid
  • Can generate significant savings

2. Reserved Instances

  • Works the same as with Linux
  • Save up to 72% by committing to 1 or 3 years

3. Consider Alternatives

  • If your app can run on Linux, the savings are immediate
  • Linux containers are often a great alternative

💡 Pro tip: If your only reason to use Windows is to run a .NET app, consider that .NET Core is cross-platform and runs perfectly on Linux, eliminating the surcharge.


What Are Containers in AWS?

A container is a unit of software that packages your application along with all its dependencies (libraries, configurations, runtime) so it runs consistently in any environment.

Think of it as a standardized shipping container: your app goes inside with everything it needs, and it runs the same on your laptop, in testing, and in production.

Containers vs Virtual Machines

 ContainerVM (EC2)
StartupSecondsMinutes
SizeMBGB
IsolationProcessVirtual hardware
CostLowerHigher

Main Container Services in AWS

🟢 ECS (Elastic Container Service)

  • AWS-native orchestrator
  • Simpler to configure
  • Ideal if you’re already in the AWS ecosystem
  • Two execution modes: EC2 or Fargate

🔵 EKS (Elastic Kubernetes Service)

  • Kubernetes managed by AWS
  • More complex but very powerful
  • Ideal if you already use Kubernetes or need portability
  • Also runs on EC2 or Fargate

🟡 Fargate

  • Serverless for containers
  • You don’t manage EC2 servers — AWS does it for you
  • Pay only for the CPU and memory your container uses
  • Ideal for teams who don’t want to manage infrastructure

🟣 ECR (Elastic Container Registry)

  • Private repository for storing your Docker images
  • Similar to Docker Hub but inside AWS
  • Natively integrates with ECS and EKS

How They All Connect

1
2
3
4
5
6
7
Your code
    ↓
Docker image  →  stored in ECR
    ↓
ECS or EKS    →  orchestrates containers
    ↓
Fargate or EC2  →  where they actually run

When to Use Containers vs Direct EC2

SituationRecommendation
Simple monolithic appDirect EC2
MicroservicesContainers (ECS/EKS)
Don’t want to manage serversFargate
Team already uses KubernetesEKS
Get started fast and simpleECS + Fargate

What Does “Serverless” Mean?

Serverless doesn’t mean there are no servers — it means you don’t manage them. AWS handles provisioning, scaling, and maintenance. You only worry about your code.

The Evolution of Infrastructure

1
2
Physical server → Virtual Machine (EC2) → Containers → Serverless
  You manage all      Less management       Even less     Just your code

Key Characteristics

⚡ Automatic Scaling Scales up and down based on demand without any configuration. If you have 0 requests, you consume 0 resources.

💰 Pay for Actual Usage No paying for a server running 24/7 — you pay per execution or per resource consumed at the moment.

🔧 Zero Maintenance No patching operating systems, updating runtimes, or managing capacity.

🚀 Fast Deployment You focus only on code, dramatically reducing time to production.


Main Serverless Services in AWS

ServicePurpose
LambdaRun code functions triggered by events
FargateRun containers without managing EC2
DynamoDBServerless NoSQL database
S3Object storage
API GatewayBuild APIs without servers
Aurora ServerlessServerless relational database

Concrete Example with Lambda

Instead of keeping an EC2 instance running and waiting for requests:

1
2
3
4
5
6
7
User uploads a photo
        ↓
Lambda automatically triggers
        ↓
Processes the image (resize, compression)
        ↓
Lambda shuts down — you stop paying

You pay only for the milliseconds the execution lasted.


Advantages and Limitations

✅ Advantages⚠️ Limitations
Very low cost for variable loadsCold start (initial startup delay)
Scales to millions of requestsExecution time limits
Zero server administrationMore complex debugging
Automatic high availabilityNot suitable for very long processes

When to Use Serverless?

Great for:

  • APIs with variable or unpredictable traffic
  • Event-driven processing (file uploads, notifications)
  • Scheduled tasks (cron jobs)
  • Mobile app backends

Not ideal for:

  • Processes that run for hours
  • Apps that need persistent in-memory state
  • Constant high loads (EC2+RI may be cheaper)

Why Is S3 Considered Serverless If It’s a Storage Server?

This is one of the most common points of confusion — and a great question.

The Key Is Perspective

S3 does run on physical servers — AWS has thousands of disks and machines dedicated to S3 in its datacenters. The point is that you never see or manage any of them.

What Serverless Means for S3

When you use S3, you never:

  • ❌ Choose how many servers to use
  • ❌ Configure the operating system
  • ❌ Define how much disk to reserve
  • ❌ Worry if a disk fails
  • ❌ Manually scale as you grow

You just do this:

1
aws s3 cp my-file.jpg s3://my-bucket/

And that’s it. AWS handles everything else internally.

The Electricity Analogy

When you plug in a device, you don’t know how many turbines or cables are involved. You just consume electricity and pay for what you use.

S3 works the same way. There’s massive infrastructure behind it, but it’s completely abstracted away from you.


Direct Comparison

 Traditional ServerS3
Are there physical servers?✅ Yes, yours✅ Yes, AWS’s
Do you manage them?✅ Yes❌ No
Do you pay fixed capacity?✅ Yes❌ No, pay what you use
Does it scale automatically?❌ Manual✅ Automatic
Can it fail and lose data?✅ Real risk❌ 99.999999999% durability

So Serverless Really Means…

A server-free experience, not a server-free architecture.

The term describes the developer experience, not the physical reality of the infrastructure.


In summary: S3 is serverless because the server exists but is invisible to you. All you see is infinite storage that scales on its own and charges you for what you use.


This guide covered the core AWS concepts around compute, pricing, containers, and serverless architecture. These building blocks form the foundation of most modern cloud applications built on AWS.

This post is licensed under CC BY 4.0 by the author.