AWS cloud practitioner notes - EC2
The content here is under the Attribution 4.0 International (CC BY 4.0) license
This post as the free official course from AWS  is the first on a series to cover the entire course content. The focus on this post is to go over the EC2 (Elastic Compute) service and another computing services that AWS provides. Besides that, a brief introduction to the model pay as you go that AWS uses is shared.
Previous: AWS Cloud Practitioner Notes
Module 1 - Introduction AWS
The first module goes on the basics of cloud computing, what it is, and AWS pay as you go model, remember:
- Cloud computing is: On-demand delivery of IT resources and applications through the internet with pay-as-you-go pricing
- 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 rent 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 : AWS EC2 uses the server as a host which can have multiple servers (EC2 instances) on it.
Provision a EC2 instance with the following OS’s:
Besides that you are in the control of network aspect of the EC2 as well.
In short, EC2 is:
Using EC2 you are responsible for:
- Set up and manage your instances
- Responsible for patching instances
- Setting up scale
- Architect in a highly available setup
Modules 2 - EC2 Instance types
Each EC2 instance type is grouped under an instance family. Instance types offer different combinations of storage, memory, processing power.
For the following list, consider the term resources as the group of: compute, 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)
Modules 2 - EC2 pricing
The EC2 pricing model vary based on the EC2 buying option:
- Savings plans (low prices, in exchange for commitments in one or three year term, leading up to 72% of saving compared to on-demand)
- Reserved instances (predictable usage up to 75% of savings compared to on-demand)
- Spot instances (Ideal for flexible workloads - therefore AWS can terminate the instance at any time). Up to 90% discount compared to On-Demand prices. 
- Dedicated (No shared tenancy of the host)
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
Modules 2 - EC2 scaling
- Vertical scaling: EC2 are resizable as well, you can upgrade or downgrade hardware aspects of the instance such as: processing power, memory and HD.
- Horizontally - creating new instances and adding them to the pool
- Dynamic scaling: responds to changing demand- Auto scaling.
- Predictive scaling: schedule the right number of EC2 based on predicted demand.
Modules 2 - Elastic load balancing (ELB)
Load balancing distributes incoming application traffic across multiple resources and its built on regional construct, it runs on regional level. The ELB has the following characteristics:
- High performance
- Highly available
- Automatically scalable
AWS provides different ELB solutions for each kind of work load :
- 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.
Modules 2 - Message and queueing
Applications that communicates directly are defined as: Tightly coupled architecture. If a single component fails or changes, it causes issues to the entire system.
talks to Application A --------------------> Application B
Loosely coupled architectures are defined as single failure won’t cause cascading failures.
sends to process _________________ Application A ------> | message queue | <-------- Application B |_______________|
For decoupled solutions, AWS provides two services:
- 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 loosing messages)
- 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.
Modules 2 - Additional compute services
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 orchestrated your containers at scale, without the hassle to manage your own 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 the access to low level components such as the operational system. In short:
- ECS on EC2 you manage
- ECS on Fargate AWS manages
For a deep dive into ECS, please visit the page dedicated to that.
- A. W. S. training and certification, “AWS Cloud Practitioner Essentials,” 2020 [Online]. Available at: https://www.aws.training/Details/eLearning?id=60697. [Accessed: 2021-Apr-1AD]
- G. Glossary, “Multitenancy,” 2021 [Online]. Available at: https://www.gartner.com/en/information-technology/glossary/multitenancy. [Accessed: 31-Jul-2021]
- AWS, “Overview of Amazon Web Services,” 2021 [Online]. Available at: https://d1.awsstatic.com/whitepapers/aws-overview.pdf. [Accessed: 2021-Jan-26AD]
Table of contents
- Module 1 - Introduction AWS
Module 2 - Introduction EC2 (CaaS)
- Modules 2 - EC2 Instance types
- Modules 2 - EC2 pricing
- Modules 2 - EC2 scaling
- Modules 2 - Elastic load balancing (ELB)
- Modules 2 - Message and queueing
- Modules 2 - Additional compute services - AWS lambda
- Modules 2 - Additional compute services - AWS ECS (Elastic container service) or EKS (Elastic Kubernetes service)
- Up next