AWS cloud practitioner notes - EC2

Last updated Apr 6, 2024 Published Jan 4, 2021

The content here is under the Attribution 4.0 International (CC BY 4.0) license

This post as the free official course from AWS [1] is the first in a series to cover the entire course content. The focus of this post is to go over the EC2 (Elastic Compute) service and other computing services that AWS provides. Besides that, a brief introduction to the model pay-as-you-go that AWS uses is shared.

In general terms, remember that:

  1. Cloud computing is the on-demand delivery of IT resources and applications through the Internet with pay-as-you-go pricing
  2. Pay on-demand: The aggregated cloud usage from a large number of customers results in lower pay-as-you-go prices.

Module 2 - Introduction EC2 (CaaS)

EC2 takes care of the part of setting up physical servers. Such as buying them, setting them up in a data center (or even renting a hack to put it in) and the security part as well. You can spin up a new server or take it down as you wish.

Multitenancy [2]: AWS EC2 uses the server as a host which can have multiple servers (EC2 instances) on it.

Provision an EC2 instance with the following OS’s:

  • Linux
  • Windows

Besides that, you are in the control of network aspect of the EC2 as well.

In short, EC2 is:

  • Flexible
  • Reliable
  • Scalable

Using EC2 you are responsible for:

  1. Set up and manage your instances
  2. Responsible for patching instances
  3. Setting up scale
  4. Architect in a highly available setup

Module 2 - EC2 Instance types

Each EC2 instance type is grouped under an instance family. Instance types offer different combinations of storage, memory, and processing power. For the following list, consider the term resources as the group of computing, memory and networking.

  • General purpose (Balanced resources: Web servers/code repository)
  • Computer-optimized (Compute intensive tasks: Gaming servers, high-performance computing - HPC, Scientific modeling, batch processing)
  • Memory-optimized (Memory intensive tasks)
  • Accelerated computing (Floating point number calculations, Graphics processing, Data pattern matching, hardware accelerators)
  • Storage-optimized (High performance for locally stored data)

Module 2 - EC2 pricing

The EC2 pricing model varies based on the EC2 buying option:

  • On-demand - charged by the usage in seconds or hour
  • Spot instances (Ideal for flexible workloads - therefore AWS can terminate the instance at any time). Up to 90% discount compared to On-Demand prices. [3]
  • Reserved instances (predictable usage up to 75% of savings compared to on-demand)
  • Dedicated (No shared tenancy of the host)
    • Savings plans (low prices, in exchange for commitments in one or three-year terms, leading up to 72% of savings compared to on-demand)

Besides that, the price can vary based on:

  • Instance type (micro, small, large, etc). Instance type refers to a combination of resources such as CPU, memory, storage, and networking capacity.
  • Selected region
  • Number of instances
  • Load balancing
  • Allocated elastic IP addresses

AWS offers a pricing calculator to simulate the costs of the used services as well as the discounts that are available based on the buying options.

Module 2 - EC2 scaling

  1. Vertical scaling: EC2 is resizable as well, you can upgrade or downgrade hardware aspects of the instance such as processing power, memory and HD.
  2. Horizontally - creating new instances and adding them to the pool
  • Dynamic scaling: response to changing demand - Autoscaling.
  • Predictive scaling: schedule the right number of EC2 based on predicted demand.

Module 2 - Elastic load balancing (ELB)

Load balancing distributes incoming application traffic across multiple resources and it’s built on the regional construct, it runs on a regional level. The ELB has the following characteristics:

  • High performance
  • Cost-efficient
  • Highly available
  • Automatically scalable

AWS provides different ELB solutions for each kind of work-load [3]:

  • Application load balancer: load balancing of HTTP and HTTPS traffic
  • Network load balancer: load balancing TCP traffic
  • Classic load balancer: basic load balancing across multiple Amazon EC2 instances. The classic load balancer is intended for applications that were built within the EC2-classic network.

Module 2 - Message and queueing

Applications that communicate directly are defined as Tightly coupled architecture. If a single component fails or changes, it causes issues for the entire system.

                    talks to
Application A --------------------> Application B

Loosely coupled architectures are defined as single failures that won’t cause cascading failures.

              sends to                  process
Application A ------> | message queue | <-------- Application B

For decoupled solutions, AWS provides two services:

  1. AWS SQS (simple queue service)

SQS queues are places where messages are stored until they are processed.

  • Send messages (data within a message: payload. It is protected until delivery)
  • Store messages
  • Receive messages
  • At any volume (without losing messages)
  1. AWS SNS (simple notification service)

SNS is a channel for messages to be delivered, pub-sub pattern. Subscribers can be web servers, email, lambda functions, etc.

Module 2 - Additional compute services

AWS Lambda

AWS lambda is a service that allows you to upload your code to be executed. The code is executed in a managed environment.

  • Lambda is designed to run code in 15 minutes
  • Automatically scale

AWS ECS (Elastic container service) or EKS (Elastic Kubernetes service)

ECS is designed to orchestrate your containers at scale, without the hassle of managing your cluster. ECS can run on top of EC2, so then you can manage details under the hood. Also, AWS offers Fargate to deploy containers, which is a managed service that removes access to low-level components such as the operational system. In short:

  1. ECS on EC2 you manage
  2. ECS on Fargate AWS manages

For a deep dive into ECS, please visit the page dedicated to that.

Up next

Infrastructure and reliability


  1. [1]A. W. S. training and certification, “AWS Cloud Practitioner Essentials,” 2020 [Online]. Available at: [Accessed: 2021-Apr-1AD]
  2. [2]G. Glossary, “Multitenancy,” 2021 [Online]. Available at: [Accessed: 31-Jul-2021]
  3. [3]AWS, “Overview of Amazon Web Services,” 2021 [Online]. Available at: [Accessed: 2021-Jan-26AD]


  • Apr 06, 2024 - Added pricing calculator reference under section EC2 pricing