2. ELASTIC COMPUTE CLOUD
● IT IS THE LEVEL AT WHICH A SYSTEM IS ABLE TO ADAPT TO WORKLOAD CHANGES
BY PROVISING AND DEPROVISIONIG RESOURCES SUCH THAT THE RESOURCES
MEET THE CURRENT DEMAND AS CLOSELY AS POSSIBLE.
(OR)
• AMAZON ELASTIC COMPUTE CLOUD EC2 IS A WEB SERVICE FROM AMAZON THAT
PROVIDES RESIZABLE COMPUTE SERVICES IN THE CLOUD.
• AMAZON IS A VIRTUAL SERVER FOR RUNNING APPLICATIONS ON AMAZON EC2.
1. SCALABLE
2. COST EFFICIENT
3. FLEXIBLE
3. Amazon EC2
• EC2 is one of the most popular of AWS’ offering
• EC2 = Elastic Compute Cloud = Infrastructure as a Service
• It mainly consists in the capability of :
• Renting virtual machines (EC2)
• Storing data on virtual drives (EBS)
• Distributing load across machines (ELB)
• Scaling the services using an auto-scaling group (ASG)
• Knowing EC2 is fundamental to understand how the Cloud works
4. EC2 sizing & configuration options
Operating System (OS): Linux, Windows or Mac OS
• How much compute power & cores (CPU)
• How much random-access memory (RAM)
• How much storage space:
• Network-attached (EBS & EFS)
• hardware (EC2 Instance Store)
• Network card: speed of the card, Public IP address
• Firewall rules: security group
• Bootstrap script (configure at first launch): EC2 User Data
5. EC2 User Data
It is possible to bootstrap our instances using an EC2 User data script.
• bootstrapping means launching commands when a machine starts
• That script is only run once at the instance first start
• EC2 user data is used to automate boot tasks such as:
• Installing updates
• Installing software
• Downloading common files from the internet
• Anything you can think of
• The EC2 User Data Script runs with the root user
6. EC2 Instance Types - Overview
• You can use different types of EC2 instances that are optimised for different use cases
(https://aws.amazon.com/ec2/instance-types/)
• AWS has the following naming convention:
m5.2xlarge
m: instance class
5: generation (AWS improves them over time)
2x: size within the instance class
7. EC2 Instance Types – General Purpose
• Great for a diversity of workloads such as web servers or code repositories
• Balance between:
• Compute
• Memory
• Networking
• In the course, we will be using the t2.micro which is a General Purpose EC2 instance
8. GENERAL PURPOSE
● BALANCED MEMORY AND CPU
● GENERAL PURPOSE INSTANCES PROVIDE A BALANCE OF COMPUTE,MEMORY &
NETWORKING RESOURCES & CAN BE USED FOR VARIETY OF WORKLOADS.
● FOR APPLICATION THAT REQURIES A BALANCE OF PERFORMANCE & COST
● WHERE YOU NEED A PROMPT RESPONSE COST EFFECTIVENESS , LESS PROCESSING
● EX: EMAIL RESPONSE SYSTEMS
9. EC2 Instance Types – Compute Optimized
• Great for compute-intensive tasks that require high performance processors:
• Batch processing workloads
• Media transcoding
• High performance web servers
• High performance computing (HPC)
• Scientific modeling & machine learning
• Dedicated gaming servers
10. COMPUTE OPTIMIZED
● ( MORE CPU THAN RAM)
● FOR APPLICATIONS THAT REQUIRE A LOT OF PROCESSING FROM THE CPU.
● EXAMPLE : ANALYSING STREAMING DATA
● EX: DATA IS CONTINOUSLY STREAMING IN & OUT WHICH NEEDS SYSTEM.
11. EC2 Instance Types – Memory Optimized
• Fast performance for workloads that process large data sets in memory
• Use cases:
• High performance, relational/non-relational databases
• Distributed web scale cache stores
• In-memory databases optimized for BI (business intelligence)
• Applications performing real-time processing of big unstructured data
12. MEMORY OPTIMIZED
● FOR APPLICATION THAT REQUIRE A LOT OF RAM.
● EX: APPLICATION THAT NEED MULTI TASKING
13. EC2 Instance Types – Storage Optimized
• Great for storage-intensive tasks that require high, sequential read and write access to
large data sets on local storage
• Use cases:
• High frequency online transaction processing (OLTP) systems
• Relational & NoSQL databases
• Cache for in-memory databases (for example, Redis)
• Data warehousing applications
• Distributed file systems
14. STORAGE OPTIMIZED
● FOR APPLICATIONS THAT ARE HUGE IN SIZE OR HAVE DATA SET THAT OCCUPIES A
LOT OF SPACE.
EX: LARGE SIZED APPLICATION
15. GPU INSTANCES
● FOR APPLICATIONS THAT REQUIRE SOME HEAVY GRAPHICS RENDERING.
EXAMPLE: 3D MODELLING
17. Introduction to Security Groups
• Security Groups are the fundamental of network security in AWS
• They control how traffic is allowed into or out of our EC2 Instances.
• Security groups only contain allow rules
• Security groups rules can reference by IP or by security group
18. Security Groups Deeper Dive
• Security groups are acting as a “firewall” on EC2 instances
• They regulate:
• Access to Ports
• Authorised IP ranges – IPv4 and IPv6
• Control of inbound network (from other to the instance)
• Control of outbound network (from the instance to other
23. EC2 Instances Purchasing Options
● • On-Demand Instances: short workload, predictable pricing
● • Reserved: (MINIMUM 1 year)
● • Reserved Instances: long workloads
● • Convertible Reserved Instances: long workloads with flexible
instances
● • Scheduled Reserved Instances: example – every Thursday between
3 and 6 pm
● • Spot Instances: short workloads, cheap, can lose instances (less
reliable)
● • Dedicated Hosts: book an entire physical server, control instance
placement
● • Dedicated Instances: no other customers will share your hardware
24. EC2 On Demand
• Pay for what you use:
• Linux or Windows - billing per second, after the first minute
• All other operating systems - billing per hour
• Has the highest cost but no upfront payment
• No long-term commitment
• Recommended for short-term and un-interrupted workloads, where you can't predict how the
application will behave
EXAMPLE: START 9:05 AM
9:10 AM => COST WILL BE FOR 1 HOUR ONLY
25. Convertible Reserved Instances (RIs): are a type of Amazon Web
Services (AWS) Reserved Instance that allows customers to
modify the attributes of the RI during the term of the reservation.
With convertible RIs, customers have the flexibility to change the
instance type, operating system, tenancy, or payment option of
their RI, which can help them to better optimize their usage and
cost savings.
Convertible RIs have a longer commitment period compared to
standard RIs, typically lasting from one to three years. The longer
the commitment period, the greater the discount that customers
receive on their hourly usage rate for the corresponding instance
type.
In addition to the benefits of traditional RIs, convertible RIs provide
additional flexibility and cost savings opportunities for customers
who want to optimize their usage of AWS. However, it's important
to note that there are restrictions and limitations on the
modifications that can be made to convertible RIs, so customers
should carefully evaluate their needs and usage patterns before
26. EC2 Reserved Instances
• Up to 72% discount compared to On-demand
• Reservation period: 1 year = + discount | 3 years = +++ discount
• Purchasing options: no upfront | partial upfront = + | All upfront = ++ discount
• Reserve a specific instance type
• Recommended for steady-state usage applications (think database)
Convertible Reserved Instance
• can change the EC2 instance type
• Up to 66% discount
Scheduled Reserved Instances
• launch within time window you reserve
. • When you require a fraction of day / week / month
27. RESERVED INSTANCE
ATTRIBUTE WHICH DECIDE RESERVED INSTANCE PRICING:
INSTANCE ATTRIBUTE
TERM COMMITMENT
INSTANCE ATTRIBUTE
1. INSTANCE TYPE
2. REGION
3. TENANCY
SHARED
DEDICATED INSTANCE
DEDICATED HOST
28. The key differences between Dedicated Instances and Dedicated Hosts are:
1.Level of Isolation: Dedicated Instances are isolated at the instance level, whereas
Dedicated Hosts are isolated at the hardware level. This means that with Dedicated Hosts,
customers have greater control over the underlying hardware and can use their own
software licenses.
2.Instance Density: Dedicated Hosts allow customers to run multiple instances on a single
physical server, whereas Dedicated Instances are limited to a single instance per physical
server.
3.Billing: Dedicated Instances are billed on an hourly basis, whereas Dedicated Hosts can
be billed on an hourly or monthly basis, depending on the customer's preference.
Overall, Dedicated Instances are a good choice for customers who need the security and
isolation of a dedicated server, but do not require full control over the underlying hardware.
Dedicated Hosts are a good choice for customers who need greater control over the
underlying hardware, and have specific requirements around software licensing and
instance density.
29. TERM COMMITMENT
● WHETHER U WILL USE THAT INSTANCE FOR ONE YEAR / THREE YEARS
● THERE IS NO AUTO RENEWEL
● AND DURATION IS FINISHED
● BUT THE INSTANCE KEEP RUNNING BUT THE BILLING PRICE WILL CHANGE.
ONE YEAR
24/03/23
NEXT YEAR
24/03/24
30. THREE PAYMENT OPTIONS:
1. ALL UPFRONT: PAY ALL THE BILL IN ADVANCE
2. PARTIAL UPFRONT: PAY ON HOURS/ PAY HALF OF THE AMOUNT & HALF AMOUNT
AWS CALCULATES IN THE MINUTES.
EXAMPLE: LIKE EMI
3. NO UPFRONT: WE ARE NOT PAYING ANYTHING IN ADVANCE.
4. OFFERING CLASS:
a) STANDARD: THEY WILL GIVE YOU MORE DISCOUNT
WE CANNOT MODIFY THE STANDARD OFFERING CLASS
WE CANNOT EXCHANGE
b) Convertible
More discount than more standard
Exchanged with another convertible
Can be modified
Selling: can be sold in the marketplace
31. AWS offers three types of Reserved Instances: Standard,
Convertible, and Scheduled. The key differences between Standard
and Convertible Reserved Instances are:
1.Flexibility: Convertible RIs offer more flexibility compared to
Standard RIs. With Convertible RIs, customers have the ability to
change the attributes of the reservation, such as the instance type,
operating system, tenancy, and payment option, during the term of
the reservation. In contrast, Standard RIs are fixed in terms of
instance type, operating system, and tenancy.
2.Pricing: Convertible RIs offer lower discounts compared to
Standard RIs, but the flexibility they offer may provide greater cost
savings opportunities. The discount rate for Convertible RIs
depends on the length of the commitment term and the type of
modification that is allowed. In contrast, Standard RIs offer higher
discounts on hourly usage rates for a fixed instance type, operating
system, and tenancy.
3.Term Length: Convertible RIs typically have longer commitment
periods compared to Standard RIs, lasting from one to three years.
In contrast, Standard RIs offer commitment periods ranging from
one to three years.
Overall, Convertible RIs are a good choice for customers who want
more flexibility and the ability to modify their Reserved Instances
during the term of the reservation. Standard RIs are a better choice
for customers who have a fixed workload and can commit to a
32. EC2 Spot Instances
• Can get a discount of up to 90% compared to On-demand
• Instances that you can “lose” at any point of time if your max price is less than the current spot price
• The MOST cost-efficient instances in AWS
• Useful for workloads that are resilient to failure
• Batch jobs
• Data analysis
• Image processing
• Any distributed workloads
• Workloads with a flexible start and end time
• Not suitable for critical jobs or databases
33. EC2 Dedicated Hosts
• An Amazon EC2 Dedicated Host is a physical server with EC2 instance capacity fully
dedicated to your use. Dedicated Hosts can help you address compliance requirements and
reduce costs by allowing you to use your existing server-bound software licenses.
• Allocated for your account for a 3-year period reservation
• More expensive
• Useful for software that have complicated licensing model (BYOL – Bring Your Own
License)
• Or for companies that have strong regulatory or compliance needs
34. EC2 Dedicated Instances
• Instances running on hardware that’s
dedicated to you
• May share hardware with other
instances in same account
• No control over instance placement
(can move hardware after Stop / Start)
35. EC2 Spot Instance Requests
• Can get a discount of up to 90% compared to On-demand
• Define max spot price and get the instance while current spot price < max
• The hourly spot price varies based on offer and capacity
• If the current spot price > your max price you can choose to stop or terminate your instance with a
2 minutes grace period.
• Other strategy: Spot Block
• “block” spot instance during a specified time frame (1 to 6 hours) without interruptions
• In rare situations, the instance may be reclaimed
• Used for batch jobs, data analysis, or workloads that are resilient to failures.
• Not great for critical jobs or databases
36. Which purchasing option
is right for me?
• On demand: coming and staying in resort
whenever we like, we pay the full price
• Reserved: like planning ahead and if we
plan to stay for a long time, we may get a
good discount.
• Spot instances: the hotel allows people to
bid for the empty rooms and the highest
bidder keeps the rooms. You can get kicked
out at any time
• Dedicated Hosts: We book an entire
building of the resort
37. difference between instance check and system check ?
In Amazon Web Services (AWS), Instance Status Checks and System Status Checks are two types
of health checks that are performed on EC2 instances to ensure that they are running properly.
Instance Status Checks verify that the instance's operating system is running correctly and that any
application software is responding as expected. These checks are performed by the hypervisor and
include verifying that the instance can communicate with other instances in the same subnet, that the
instance's network settings are configured correctly, and that the instance's storage devices are
functioning properly. Instance Status Checks are typically performed at the EC2 instance level
When instance check fails?
• It needs troubleshoot
• 1st problem: need to understand how the instance check got failed
• 2nd problem: REBOOT
38. System Status Checks verify that the underlying hardware and network infrastructure that the
instance is running on is functioning correctly. These checks are also performed by the
hypervisor and include verifying that the network connectivity between the instance and the
internet is functioning correctly, that the power and network connectivity to the instance is
stable, and that the underlying hardware, such as the CPU, memory, and storage, is
functioning properly. System Status Checks are typically performed at the AWS infrastructure
level.
WHEN SYSTEM STATUS CHECK FAILS?
=> U NEED TO START AND STOP THE INSTANCE
39. The key differences between Instance Status Checks and System Status
Checks are:
1.Scope: Instance Status Checks are performed at the instance level,
while System Status Checks are performed at the AWS infrastructure
level.
2.Focus: Instance Status Checks focus on the instance's operating
system and application software, while System Status Checks focus on
the underlying hardware and network infrastructure.
3.Purpose: Instance Status Checks are designed to help identify issues
that may be specific to the instance, such as problems with the operating
system or applications running on the instance. System Status Checks
are designed to help identify issues that may be affecting multiple
instances, such as problems with the underlying hardware or network
infrastructure.
Overall, Instance Status Checks and System Status Checks are both
important for ensuring the health and availability of EC2 instances. It's
41. AMI (AMAZON MACHINE IMAGE)
● AMI ARE PRECONFIGURED TEMPLATE.
● AMI CONTAINS OPERATING SYSTEM + ADDITIONAL SOFTWARE.
● AMI REGION SPECIFIC
● IT IS A PRECONFIGURED TEMPLATE WHICH IS USED TO LAUNCH THE SERVER /VIRTUAL
SERVER
● PRECONFIGURED: IT PROVIDES INFORMATION REQUIRED TO LAUNCH THE INSTANCE
● CAN YOU LAUNCH INSTANCE WITHOUT AMI?
=> NO
42. CAN I LAUNCH MULTIPLE SERVERS WITH SAME AMI?
=> YES
● AMI INCLUDE:
ONE /MORE EBS BASED SNAPSHOT OR INSTANCE STORED BACKED AMI
IT ALSO CONTAINS LAUNCH PERMISSION . IT SPECIFIES WHO CAN LAUNCH PERMISSION
BLOCK DEVICE MAPPING => WHICH SPECIFIES VOLUME IS ATTACHED WITH IT.
WHERE AMI STORES?
BY DEFAULT IT STORES IN S3.
IT IS MANAGED BY AWS
44. ● REGISTER-> AMI -> CREATE INSTANCE,COPY INSTANCE ,LAUNCH INSTANCE
IF YOU WANT TO COPY?
YOU SHOULD HAVE THE PERMISSION
DEREGISTER AMI: IT WILL GONE FROM THE CONSOLE.
=> IT WILL GO TO THE RECYCLE BIN (AND WE CAN REUSE THEM)
45. TYPES OF AMI IMAGES:
1 PUBLIC AMI: IT IS FREE TO USE PUBLICALLY AVAILABLE (AWS PROVIDED)
2 PRIVATE AMI: CAN BE USED ONLY IN YOUR ACCOUNT.
3. MARKET PLACE AMI / PAID AMI: AN AMI SOMEONE ELSE MADE & POTENTIALLY SELLS.
4.COMMUNITY AMI: GROUP OF PEOPLE
5. YOUR OWN AMI: YOU MAKE & MAINTAIN THEM YOURSELF.