Part 3: Cloud Practitioners Exam Study Session EC2
Tags: aws, beginners, cloud, ec2
Published: 2020-12-04 00:46:06

I've been working on the Cloud Guru AWS Cloud Practitioners course which I started through [7-day free trial here](https://acloudguru.com/pricing). My Exam is scheduled for Dec. 17th! Feel free to wish me luck :) You can check out my other study guides [here](https://dev.to/acasarsa).

This is a long one so buckle up! EC2 is an important part of the exam so I'm outlining all the major points. 

Simply put, Elastic Compute Cloud (EC2) is a virtual server(s) in the cloud. It reduces the time required to obtain and boot new server instances to minutes, allowing you to quickly scale capacity, both up and down, as your computing requirements change. 

## A Little History 
EC2 and public cloud providers, in general, revolutionized tech because prior to EC2 it could take months to get distributions up and running. These all had to be done manually with physical servers and many labor hours setting them to the correct specifications. 

Then Amazon EC2 came along and you could log into the console and get a virtual machine spun up in minutes if not seconds. This also allows businesses to expand or decrease their server needs at the click of a button, instead of being locked into 3-5 year contracts to rent physical servers. 

### **Official Definition**
Electric Compute Cloud (EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.

# **For the Exam**

For the exam you'll need to know generally what EC2 is, its pricing models, and the Elastic Block Store (EBS) which is storage designed for use with EC2.  
 
![AWS-Pricing](https://dev-to-uploads.s3.amazonaws.com/i/4p9vexfe65c7kb3dytrt.png)
 
### **EC2 Pricing Models**  
1. **On-Demand** - fixed rate by the hour (or second) with no commitment
2. **Reserved** - a capacity reservation, w/ huge discount on hourly charges for an instance. Contract Terms are 1 or 3 years. 
    * More you pay upfront here the greater your discount is (pay all 3 years upfront and get the best discount)
    * Reserved instances are the most economical option for long-term workloads with predictable usage patterns.
3. **Spot** - Bid whatever price you want for instance capacity, prices fluctuate constantly 
    * useful if your applications have flexible start and end times because you can save the most.
    * set a bid price and when it hits that price it provisions the instance. You pay the Spot price that's in effect at the beginning of each instance-hour for your running instance
    * you will never pay more than your maximum set price.  
4. **Dedicated Hosts** - Physical EC2 server dedicated for your use. 
    * these can help reduce costs by allowing you to use your existing server-bound software licenses. 

#### **On-Demand Pricing**

Offers the low cost and flexibility of Amazon EC2 w/out any up-front payment or long-term commitment

**When it's useful:** 
* apps w/ short term, spiky, or unpredictable workloads that cannot be interrupted. 
* apps being developed or tested on Amazon EC2 for the first time. 

#### **Reserved Pricing**
Allows users to save money on total computing costs by paying more upfront 

**When it's useful:**
* apps w/ steady state or predictable usage
* if app requires reserved capacity

*There are different types of EC2 instances, this effects price*

**Reserved Pricing Types:**
* Standard Reserved Instances 
    * Up to 75% off On-Demand instances. The more you pay upfront the longer the contract and the greater the discount. 
    * can't change between instance family
        - e.g. can't go from high-performance memory to compute 
* Convertible Reserved Instances
    * Up to 54% off On-Demand capability to change the attributes of the RI as long as the exchange results in the creation of RI of equal or greater value. 
* Scheduled Reserved Instances 
    * available to launch within certain time windows you reserve. 
    * This option allows you to match your capacity reservation to a predictable recurring schedule that only requires a fraction of a day, week, or month.  
        - e.g. maybe your team only needs server access from 9-10 am so you would set it for that time

#### **Spot Pricing** 
Allows users to set a maximum price they're willing to pay for an EC2 instance. Instance will terminate if Spot price exceeds that amount. Useful if your applications have flexible start and end times and it won't matter if the instance stops suddenly.

**A Note about liability**
If a Spot instance is terminated by Amz EC2 because it's gone over what you are willing to pay for it. You will not be charged a partial hour of usage! 

However, if you terminate the instance yourself, you will be charged for any hour in which the instance ran. 

**When it's useful:**
* fault-tolerant and flexible applications
    * ex: web servers, API backends, continuous integration/continuous development, and Hadoop data processing
* company has heavy compute needs but flexible hours, they could run all their heavy computing in the middle of the night to save costs
* users w/ urgent computing needs for large amounts of capacity 
    * can do a comparison between spot prices and On-Demand prices to see which is more cost-effective at the time.

#### **Dedicated Hosts Pricing**
can help reduce costs by allowing you to use your existing server-bound software licenses (not very common but for certain techs you must have them on a dedicated host as per licensing terms and conditions)
  
**When it's useful:**
* regulatory requirements that may not support multi-tenant virtualization
    * e.g. in government department where there's a law that says data must be on dedicated hosts. 
* licensing which does not support multi-tenancy or cloud deployments
    * e.g. Microsoft, VMware or Oracle Licensing 
* can be purchased On-Demand (hourly)
* can be purchased as a Reservation for up to 70% off the On-Demand price

### **What is AWS Elastic Block Store?**
![elastic](https://dev-to-uploads.s3.amazonaws.com/i/z3l55tamkb2wyyxn6605.jpeg)
 
Simply, it's a virtual hard disk in the cloud that EC2 uses for storage. 

EBS allows you to create storage volumes and attach them to EC2 instances. Once attached, you can create a file system on top of these volumes, run a database, or use them however you would use a block device (virtual/physical harddisk). 
* EBS volumes are placed in an Availability Zone, where they automatically replicate to protect you from failure of a single component.

#### **Volume Types:**
**SSD** 
* general purpose SSD (GP2) balances price and performance for a wide variety of workloads
* Provisional IOPS SSD (IO1) **highest-performance** SSD volume for mission-critical low-latency or high-throughput workloads
    * IOPS => Input Output Per Second 
    * e.g. If you have a really high performing DB you want IOPS instead of GP2 

**Magnetic**
* Throughput Optimized HDD (ST1) low-cost HDD volume for **frequently accessed** or high throughput intensive workloads
    * data warehouses
* Cold HDD (hard disk drive) (SC1) - **lowest cost** HDD vol for **less frequently accessed** workloads (file servers) 
* Magnetic - Previous Generation 

Well, that wraps things up for Amazon's Elastic Compute Cloud (EC2). 

{% link https://dev.to/acasarsa/part-i-notes-on-studying-for-aws-practitioners-exam-325d %}

{% link https://dev.to/acasarsa/part-ii-notes-on-studying-for-aws-practitioners-exam-3i4g %}