Elastic Compute Cloud (EC2)

Icon

EC2 Icon

Basics

User Data

  • 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.

Instance Types

  • They are categorized based on instance types.

  • Detailed list can be found here.

  • For comparison of instance type visit this.

Naming convention

  • <instance-class><class-generation>.<size-of-instance-class>

  • Example: m5.2xlarge

    m: instance class
    5: generation class
    2xlarge: size within instance class

Instances Puchasing Options

  • The following are different purchasing options available for EC2 instance.

On-Demand Instances

  • 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.

Reserved (1 or 3 years)

Reserved Instances

  • 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.

Convertible Reserved Instances

  • Can changes EC2 insance type, family, OS, scope and tenancy.

  • Upto 66% discount (aws may change this over time).

Savings Plan (1 & 3 years)

  • 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.

Spot Instances

  • 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.

Dedicated Instances

  • 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.

Dedicated Hosts

  • 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.

Capacity Reservations

  • 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.

References

Last updated