AWS - EC2

 

 

 


Instance

 

AMI PV vs HVM

  • PV: Paravirtual
  • HVM: Hardware Virtual Machine

PV

Paravirtual guests can run on host hardware that does not have explicit support for virtualization.
(Intel Virtualization Technology)

Boot

PV AMIs boot with a special boot loader called PV-GRUB,

  which starts the boot cycle and then chain loads the kernel specified in the menu.lst file on your image.

HVM boot by executing the master boot record of the root block device of your image.

Performance

PV guests had better performance than HVM guests in many cases,

  but because of enhancements in HVM virtualization and

  the availability of PV drivers for HVM AMIs, this is no longer true.

 


AMI

 

Deregister your Linux AMI

When you deregister an AMI:

 * it doesn't affect any instances that you've already launched from the AMI.

 * it doesn't affect the snapshot(s) that were created for the volume(s) of the instance
    during the AMI creation process.

 * You'll continue to incur storage costs for the snapshots.

 


General Purpose SSD storage

 

Baseline I/O performance for General Purpose SSD storage is 3 IOPS for each GiB, with a minimum of 100 IOPS.

 


Centos AWS Instance

 

https://wiki.centos.org/Cloud/AWS

 


Instances 's Credit specification

 

Instance can sustain high CPU utilization for any period of time whenever required.

Setting

T3 instances launch as unlimited by default.

It can be enabled or disabled at any time for a running or stopped instance.

Credits

If the average CPU usage over a 24-hour period exceeds the baseline, you incur charges for surplus credits.

When its CPU utilization falls below the baseline,

it uses the CPU credits that it earns to pay down the surplus credits that it spent earlier.

The hourly instance price automatically covers all CPU usage spikes

  if the average CPU utilization of the instance is at or below the baseline over a rolling 24-hour period or

  the instance lifetime, whichever is shorter.

1 CPU credit 相當於

  • One vCPU at 100% utilization for one minute
  • One vCPU at 50% utilization for two minutes
  • Two vCPUs at 25% utilization for two minutes

Earning CPU credits

t3.nano

CPU credits earned per hour: 6
Maximum earned credits that can be accrued: 144
vCPUs: 2
Baseline utilization per vCPU: 5%

t3.micro     

CPU credits earned per hour: 12
Maximum earned credits that can be accrued: 288
vCPUs: 2
Baseline utilization per vCPU: 10%

Maximum earned credits that can be accrued:

相當於 24hr 內可以賺到幾多 credits

For T3 and T4g, the CPU credit balance persists for 7 days after an instance stops and the credits are lost thereafter.

Baseline utilization:

它是 Per vCPU

(number of credits earned/number of vCPUs)/60 minutes = %

i.e. t3.nano

6 / 2 / 60 = 5%

Credits Usage

Spent surplus credits are tracked by the CloudWatch metric CPUSurplusCreditBalance

CPUCreditUsage

CPUCreditBalance

T2/T3 Unlimited Mode Pricing

For T2 and T3 instances in Unlimited mode, CPU Credits are charged at per vCPU-hour

  • $0.05 per vCPU-Hour for Linux, RHEL and SLES
  • $0.096 per vCPU-Hour for Windows and Windows with SQL Web

When to use unlimited mode versus fixed CPU (breakeven CPU usage)

If a T3 instance continuously bursts at 100% CPU,

you end up paying approximately 1.5 times the price of an equivalently-sized M5 instance.

T3 instance 累計幾多 % CPU 後應選用 M5 instance

t3.large     42.5%
t3.xlarge     52.5%
t3.2xlarge     52.5%

 

 


ECUs

 

 - ECU = EC2 Compute Unit
 - processing power metric
 - 引入原因: 不同 HW 有不同 vCPU 很難比較

 


Placement group

 

When you launch a new EC2 instance, the EC2 service attempts to spread out across underlying hardware

There is no charge for creating a placement group.

Cluster

packs instances close together inside an Availability Zone.
(low network latency)

* Start fails if there isn't enough capacity for the instance

Partition -

No two partitions within a placement group share the same racks
(Each rack has its own network and power source)

Spread

distinct underlying hardware

 


Capacity Reservation setting (open|none)

 

 

Capacity Reservation setting (open|none)

open - The instance can run in any open Capacity Reservation that has matching attributes
(instance type, platform, Availability Zone).

none - The instance avoids running in a Capacity Reservation even if one is available.

By creating Capacity Reservations

you ensure that you always have access to EC2 capacity when you need it,
for as long as you need it.
You can create Capacity Reservations at any time,
without entering into a one-year or three-year term commitment,
and the capacity is available immediately.
Billing starts as soon as the capacity is provisioned and the Capacity Reservation enters the active state.
When you no longer need it, cancel the Capacity Reservation to stop incurring charges.

To create a Capacity Reservation using the console

1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/

2. Choose Capacity Reservations, and then choose Create Capacity Reservation.

3. ...

Pricing

When the Capacity Reservation enters the active state,

you are charged the equivalent On-Demand rate whether you run instances in the reserved capacity or not.