Elastic Compute Cloud (EC2)
Last updated
Last updated
User Data is basically bootstrap script that runs once at the instance's first start of its entire lifecycle.
This enables us to run software installation, updates.
This script runs with root privilege.
They are categorized based on instance types.
Detailed list can be found here.
For comparison of instance type visit this.
<instance-class><class-generation>.<size-of-instance-class>
Example: m5.2xlarge
The following are different purchasing options available for EC2 instance.
Pay as per your usage
Windows and Linux, billing per second, after first minute.
Other OS, billing per hour.
Highest cost but no upfront payment.
No long-term commitment.
Recommended for short and uninterrupted workloads, where you can't predict application behavior.
Upto 72%
discount (aws may change this over time) compared to On-demand.
Reserve based on specific instance attribute (Instance Type, Region, Tenancy, OS).
Payment Options - No/partial/fully upfront, where all upfront gives maximum discount.
Scope can be regional or zonal.
Recommended for steady-state usage applications.
Can buy or sell reserved instances from Reserved Instance Marketplace.
Can changes EC2 insance type, family, OS, scope and tenancy.
Upto 66%
discount (aws may change this over time).
Discount based on long term usage (upto 72%
same as Reserved instances) (aws may change this over time).
Requires commitment to certain type of usage (like Rs1000 per hour).
Usage beyond the savings plan is billed on On-Demand instance family.
Locked to a specific instance family and region. However instance-size, OS, tenancy can be changed.
Can get upto 90% discount compared to On Demand.
These are instances which you can lose at any point in time if max price is less than the current spot price.
This is the most cost-efficient instances in AWS.
Recommended for work-load that is resillient to failure like batch jobs, data analysis, image processing, workloads with flexible start and end time.
Not suitable for critical jobs or databases.
Instances run on hardware that's dedicated to you.
May share hardware with other instances in same account, but not with other account.
No control over instance placement.
A physical server with EC2 instance capacity fully dedicated to your use, will not be shared with any other customer (dedicates a physical server).
Can control instance placement.
Recommended to address strong regulatory or compliance requirement.
Purchasing options can be like on-demand and reserved (1 year or 3 year). Most expensive option.
Useful for softwares that have complicated licensing model (BYOL - Bring Your Own License).
Gives you visibility to the underlying hardware unlike Dedicated Instances.
Reserve On-demand instances capacity in a specific AZ for any duration.
You always have EC2 capacity when you need it.
No time commitment, no billing discounts.
To get discounts one can combine them with Regional Reserved Instances and Savings Plan.
Charged based on On-demand rate whether you run instances or not.
Suitable for short-term, uninterrupted workloads in a specific AZ.
Read more about EC2 instance pricing here.
Read more about EC2 instance life-cycle here.
Difference between Dedicated Host v/s Dedicated Instance