[ 1. EC2 Instance Launch Types ]
1. On Demand Instances : short workload, predictable pricing
2. Reserved: (Minimum 1year)
- Reserved Instances: long workloads
- Convertible Reserved Instances: long workloads with flexible instances
- Scheduled Reserved Instances: eg. every Thursday between 3 and 6 pm
3. Spot Instances: short workloads, for cheap, can lose instances (less reliable)
4. Dedicated Instances : no other customers will share your hardware
5. Dedicated Hosts: book an entire physical server, control instance placement
1. EC2 On Demand
필요시에만 사용, 비쌈
- Pay for what you use (billing per second, after the first minute)
- 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.
2. EC2 Reserved Instances
선불제, 비교적 저렴
- Up to 75% discount compared to On-demand
- Pay upfront for what you use with long term commitment
- Reservation period can be 1 or 3 years
- Reserve a specific instance type
- Recommended for steady state useage applications(think database)
* Convertible Reserved Instance
- can change the EC2 instance type
- Up to 54% discount
* Scheduled Reserved Instances
- launch within time window you reserve
- When you require a fraction of day/week/month
3. 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 prices is less then the current spot price
- The Most cost-efficient instances in AWS
- Useful for workloads that are resilient(회복력있는/탄력적인) to failure
eg. Batch jobs, Data analysis, Image processing
- Not great for critical jobs or databases
- Great combo : Reserved Instances for baseline + On-Demand & Spot for peeks
- 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
[ # How to terminate Spot Instances ]
Spot request 설정시 지정한 request type 에 따라, 설정한 max price 에 도달했을 때의 인스턴스 동작이 달라짐
1) one-time : 설정한 spot request 가 인스턴스 런칭과 함께 사라짐. max price 도달시 인스턴스 stop or terminate.
2) persistent : 설정한 spot request 가 남아, 인스턴스가 terminated 돼도 인스턴스를 다시 런칭시킴
* persistent request type 인 경우, spot request 를 먼저 cancel 한 후, spot instance를 terminate 시켜야 함
* You can only cancel Spot Instance requests that are open, active, or disabled.
(open/active/disabled 상태일 때만 spot request 제거 가능)
4. EC2 Dedicated Hosts
사용자 전용의 물리적 서버, 딮한 설정 가능
- Physical dedicated EC2 server for your use
- Full control of EC2 Instance placement
- Visibility into the underlying sockets/physical cores of the hardware
- Allocated for your account for a 3 year period reservation
- More expensive
- Useful for software that have complicated licensing model
Or for companies that have strong regulatory or compliance needs
5. 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)
[ Spot Fleets ]
- Spot Fleets = set of Spot Instances + (Optional) On-Demand Instances
- The Spot Fleet will try to meet the target capacity with price constraints
1) Define possible launch pools: instance type (m5.large), OS, AZ
2) Can have multiple launch pools, so that the fleet can choose
3) Spot Fleet stops launching instances when reaching capacity or max cost
- Strategies to allocate Spot Instances:
1) lowestPrice : from the pool with the lowest price (cost optimization, short workload)
2) diversified : distributed across all pools (great for availability, long workloads)
3) capacityOptimized : pool with the optimal capacity for the number of instances
* Spot Fleets allow us to automatically request Spot Instances with the lowest price
[ 2. EC2 Instance Types ]
R : appliations that needs a lot of RAM - in-memory caches
C : applications that needs goods CPU - compute/databases
M : applications that are balanced (think "medium") - general/web app
I : applications that need good local I/O (instance storage) - databases
G : applications that need a GPU - video rendering/machine learning
T2/T3 : burstable instances (up to a capacity)
트래픽이 폭발하는 경우 CPU가 이에 맞게 뛰어난 퍼포먼스를 보여줌 이때 credit 을 소모하며 credit 을 다 사용하는 경우 CPU 성능은 다시 떨어짐. 이후 credit 이 다시 축척됨.
- AWS has the concept of burstable instances (T2/T3 machines)
- Burst means that overall, the instance has OK CPU performance
- When the machine needs to process something unexpected, it can burst, and CPU can be very good.
- If the machine bursts, it utilized "burst credits"
- If all the credits are gone, the CPU becomes BAD
- If the machine stops bursting, credits are accumulated over time
- Burstable instances can be amazing to handle unexpected traffix and getting the insurance that it will be handled correctly
If your instance consistently runs low on credit, you need to move to a different kind of non-burstable instance
TC/T3 - unlimited : umlimited burst
credit 과 상관없이 CPU 가 항상 burst 에 대응함. 대신 추가적인 비용을 지불.
- unlimited burst credit balance
- You pay extra money if you go over your credit balance, but you don't lose in performance
- Overall, it is a new offering, so be careful, costs could go high if you are not monitoring the health of your instances
'infra & cloud > AWS' 카테고리의 다른 글
[AWS] ENI (Elastic Network Interfaces), EC2 Hibernate (0) | 2021.03.14 |
---|---|
[AWS] EC2 Placement Groups (0) | 2021.03.14 |
[AWS] 1-4. AMI, how to copy AMI (0) | 2021.03.14 |
[AWS] 1-2. EC2, Security Groups, Elastic IPs (0) | 2021.03.11 |
[AWS] 1-1. AZ (Availability Zones), IAM (Identity and Access Management) (0) | 2021.03.10 |