COMPUTE
EC2, Auto Scaling
Agenda
●
EC2
➢
Introduction of EC2
➢
Benefits of EC2
➢
Launching EC2 Instance
➢
EC2 Limits
●
Auto Scaling
➢
Introduction of Auto Scaling
➢
Auto Scaling Functionality
➢
Auto Scaling Limits
Introduction of EC2
● Resizable compute capacity
● Complete control of your computing resources
● Reduces the time required to obtain and boot new server
instances to minutes
➔ Amazon EC2 Facts
● Scale capacity as your computing requirements change
● Pay only for capacity that you actually use
● Choose Linux or Windows
● Deploy across AWS Regions and Availability Zones for reliability
Elastic Compute Cloud (EC2)
●
Virtual computing environments, known as EC2 instances
●
Pre-configured templates for EC2 instances, known as Amazon
Machine Images (AMI)
●
AMI includes the operating system and additional software
●
Various configurations of CPU, memory, storage, and networking
capacity for your instances, known as Instance types
●
Secure login information for your instances using key pairs
●
Instance store volumes are used for temporary data that’s deleted
when you stop or terminate your instance
●
Persistent storage volumes for data using Elastic Block Store (EBS)
EC2 (Cont..)
●
Regions and Availability Zones are multiple physical locations
for your resources, such as instances and EBS volumes
●
A firewall to specify the protocols, ports, and source IP ranges
that can reach your instances using Security Groups
●
Static IP addresses, known as Elastic IP addresses
●
Metadata, known as tags , can be created and assigned to EC2
resources
●
Virtual networks that are logically isolated from the rest of the
AWS cloud, and can optionally connect to on premise network,
known as Virtual private clouds (VPCs)
Benefits of EC2
●
Elastic Web-Scale Computing
●
Completely Controlled
●
Flexible Cloud Hosting Services
●
Integrated
●
Reliable
●
Easy to Start
●
Inexpensive
●
Secure
EC2 Instance Purchasing Options
●
On-Demand instances ●
Spot instance
●
Reserved Instances ●
Dedicated Hosts
●
Scheduled Instances
On-Demand Reserved Scheduled Spot Dedicated
Instance Instance Instance Instance Hosts
Purchase, at a Bid on unused Pay for a physical
significant discount, instances, host that is fully
instances that are which can run dedicated to
always available Purchase a as long as they running your
1- year are available instances, and
Pay by the hour
recurring and your bid is bring your existing
period of time above the Spot per-socket, per-
1- year to 3- year price, at a core, or per-VM
terms. significant software licenses to
discount. reduce costs.
EC2 Instance Types
Instance Family Types Use Cases
● T2 Websites and web applications
General ● M4 Small and mid-size
databases
Purpose ● M3 High Frequency applications
C4 Web-servers
Compute ●
Support for clustering
Optimized
● C3
EC2 Instance ● X1 Big data processing
Memory ● R4 Data mining & analysis
Optimized ● R3 Support for Enhanced Networking
● P2 Machine learning
Accelerated ● G3 3D visualizations
Computing ● F1 Real-time video processing
Storage ● I3 NoSQL databases like MongoDB
Optimized ● D2 Log or data-processing applications
EC2 Launching Functionality
●
Amazon EC2 Launching Functionality
➢
Choose an Amazon Machine
AWS Console
Image
➢
Choose an Instance Type
➢
Configure Instance Details
AWS CLI ➢
Add Storage
➢
Add Tags
➢
Configure Security Group
AWS SDKs
➢
Review Instance Launch
➢
Select a key pair, existing or
new.
How to Launch EC2 Instance
AMI
Type
Launch
Configure Key Pair
Storage Security Group
Tag
Availability Zone -1
Region
AWS EC2 Limits
S No Resource Default Limit
1. Elastic IP addresses for EC2-Classic 5
2. Security groups for EC2-Classic per 500
instance
3. Rules per security group for EC2- 100
Classic
4. Key pairs 5,000
5. Throttle on the emails that can be sent Throttle applied
from your Amazon EC2 account
6. On-Demand Instances Limits vary depending on instance type. For more information,
see How many instances can I run in Amazon EC2.
7. Spot Instances Limits vary depending on instance type, region, and account.
For more information, see Spot Instance Limits.
8. Reserved Instances 20 Reserved Instances per Availability Zone, per month, plus 20
regional Reserved Instances. For more information, see
Reserved Instance Limits.
9. Dedicated Hosts Up to two Dedicated Hosts per instance family, per region can
be allocated.
10. AMI Copies Destination regions are limited to 50 concurrent AMI copies at a
time, with no more than 25 of those coming from a single
source region.
Cost vs. RAM for AWS Instance
●
For Each start and stop price will be calculated
●
Pricing calculation of EC2 instance
➢
EBS Volume ➢
Pricing Option ➢
Data Transfer
➢
Instance Type ➢
AMI Type ➢
Region
Auto Scaling
Auto Scale Group
●
Auto Scaling allows automatically scale of the capacity up
seamlessly during demand spikes to maintain performance.
●
Auto Scaling scales down during demand spikes is zero to minimize
costs
●
Auto Scaling is done in diff AZ bit not diff Regions
EC2 Instance Auto Scaling
Group
Scale out
Attach
Instance
Pending Pending : Wait
Detaching Detach
In Service Pending : Proceed
Instance
EC2 Instance Launching
Lifecycle Hook
Enter Stand by
Fail Health
Detached Check
Scale in
Exit Stand by EnteringStandby
Terminating:Wait Terminating
Standby
Terminating:Proceed Terminated
EC2 Instance Terminating
Lifecycle Hook
Auto Scaling
●
Elastic Load Balancing automatically distributes incoming application
traffic across multiple Amazon EC2 instances
●
Provide tools to build failure resilient applications by launching
application instances in separate AZ's
●
Pay only for resources actually consume, instance-hours
●
VM Import/Export enables you to easily import virtual machine images
from your existing environment to Amazon EC2 instances and export
them back at any time
Auto Scaling Functionality
●
Create a Launch Configuration ●
Create an Auto Scaling
Group
●
Verify Your Auto Scaling Group
Auto Scaling Functionality (cont..)
1. Configure Auto Scaling group details
●
Group name: --sample--
●
Group size: --3--
●
Network: --vpc123--
●
Subnet: --subnet123--
2. Configure scaling policies
●
Keep this group at its initial size
●
Use scaling policies to adjust the
capacity of this group
3. Add Notification
4. Configure Tags
5. Review
Create Auto Scaling Group
Auto Scale Launch Configuration
Auto Scaling Plans
➢
Maintain current instance
➢
Manual scaling
➢
Scale based on a schedule
➢
Scale based on demand
Auto Scaling Limits
S No Resource Default Limit
1. Launch configurations per region 100
2. Auto Scaling groups per region 20
3. Scaling policies per Auto Scaling group 50
4. Scheduled actions per Auto Scaling group 125
5. Lifecycle hooks per Auto Scaling group 50
6. SNS topics per Auto Scaling group 10
7. Classic Load Balancers per Auto Scaling group 50
8. Target groups per Auto Scaling group 50
9. Step adjustments per scaling policy 20