AW Cloud: EC2 Instances
Tags: ec2, pricing, overview
Published: 2023-01-11 13:34:57

## Disclaimer:
This is an overview of  Amazon Web Services (AWS) which I will write as a preparation to CLF-C01 Exam.

## What is EC2 instance?
EC2 stands for Elastic Computer Cloud and EC2 instance, allows you to provision virtual servers.
**There is 3 types of compute option:**
- Virtual machine,
- Containers,
- Serveless.

## How to create and what is AMI?
Creation of the instance is very eas by AMI, stand for Amazon Machine Image; is a supported and maintained image provided by AWS that provides the information required to launch an instance.

All virtual instances creating from the Amazon Machine Image (AMI). Each image has they own ID and you can use this ID in your automation tasks. It contains all the information about hhow you want your instances to be configured. You can create multiple instances with the same configuration with a single AMI.

## AWS EC2 Instance Types

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ad8k30cqiac6pkyy1zg.png)

1. General-purpose Instances
General-purpose instances provide a balance among compute, memory, and networking resources, and they can be used for a variety of workloads.

2. Compute-optimized Instances
These instances are useful for intensive tasks that need high-performance processors.

3. Memory-optimized Instances
These instances are for delivering fast performance for processing large data sets in memory.

4. Storage-optimized Instances
Storage-optimized instances are designed for workloads that contain very large data sets which has to be written in memory and require high, sequential read and write access.

5. Accelerated computing.
Instances intended for floating-point number calculation, graphics processing.

> Every EC2 instance has they own size and type: for example: t3.medium == type.size

## EC2 lifecycle

- You lunch EC2 instances from AMI,
- Once EC2 is lunched, it enters in pending stat; this state is yout VM booting up,
- Once instances ready to use, it enters on running state,
- After this state the instances will be stopped or terminate.

> In EC2, you only get charget for an EC2 instances if you are in running state or in stopping state, preparing to hibernate.

## EC2 pricing options

1. On demand: You pay for the duration that instances run for, with no long term commitments.

2. The Reserved pricing model is similar to On-Demand pricing. You receive a bill each month. Users commit to use AWS for one to three years. You can also specify the amount you’re willing to pay per hour for an instance. In addition, you have to estimate the resources you’ll need throughout the life cycle. AWS will reserve instances for future use based on your agreement.

3. Spot instance: Spot Instances allow you to make good use of someone else’s unused capacity. For this reason, Spot Instances are usually cheaper. However, this model fluctuates, and there’s no stability. That’s why AWS recommends using them for testing purposes.

## Practice
To practice EC2 instance, check the link below.

https://aws-tc-largeobjects.s3-us-west-2.amazonaws.com/DEV-AWS-MO-GCNv2/exercise-3-compute.html

## Conclusion
Here’s the very brief classification of EC2 instances, AMIs and pricing plans. Hope this information was helpful.