---
# System prepended metadata

title: Amazon EC2 pricing

---

Module 2

## Learning objectives
* Describe the benefits of Amazon EC2 at a basic level.

* Identify the different Amazon EC2 instance types.

* Differentiate between the various billing options for Amazon EC2.

* Summarize the benefits of Amazon EC2 Auto Scaling.

* Summarize the benefits of Elastic Load Balancing.

## Amazon Elastic Compute Cloud (Amazon EC2) :+1: 
>provides secure, resizable compute capacity in the cloud as Amazon EC2 instances. 
        

`with an Amazon EC2 instance you can use a virtual server to run applications in the AWS Cloud `
You pay only for the compute time you use when an instance is running, not when it is stopped or terminated.

`
`
You can save costs by paying only for server capacity that you need or want.
`

## Amazon EC2 instance type

#### 1. General purpose instances
> provide a balance of compute, memory, and networking resources. You can use them for a variety of workloads
#### 2. Compute optimized instances
> are ideal for compute-bound applications that benefit from high-performance processors. Like general purpose instances, you can use compute optimized instances for workloads such as web, application, and gaming servers.

#### 3. Memory optimized instances
> are designed to deliver fast performance for workloads that process large datasets in memory. In computing, memory is a temporary storage area. It holds all the data and instructions that a central processing unit (CPU) needs to be able to complete actions. Before a computer program or application is able to run, it is loaded from storage into memory. This preloading process gives the CPU direct access to the computer program.

#### 4. Storage optimized instances
> are designed for workloads that require high, sequential read and write access to large datasets on local storage


# Amazon EC2 pricing
        you pay only for the compute time that you use
### pricing options for different use cases

### 1. On-Demand 
> are ideal for short-term, irregular workloads that cannot be interrupted. No upfront costs or minimum contracts apply. The instances run continuously until you stop them, and you pay for only the compute time you use.

### 2. Savings Plans
>enable you to reduce your compute costs by committing to a consistent amount of compute usage for a 1-year or 3-year term.
>This term commitment results in savings of up to 72% over On-Demand costs.
> Any usage beyond the commitment is charged at regular On-Demand rates

### 3. Reserved Instance
> are a billing discount applied to the use of On-Demand Instances in your account. You can purchase Standard Reserved and Convertible Reserved Instances for a 1-year or 3-year term, and Scheduled Reserved Instances for a 1-year term. You realize greater cost savings with the 3-year option.

### 4. Spot Instances
>  are ideal for workloads with flexible start and end times, or that can withstand interruptions. Spot Instances use unused Amazon EC2 computing capacity and offer you cost savings at up to 90% off of On-Demand prices

### 5. Dedicated Hosts
> are physical servers with Amazon EC2 instance capacity that is fully dedicated to your use. `Dedicated Hosts are the most expensive.`

# Scaling Amazon EC2

## Scalability
>nvolves beginning with only the resources you need and designing your architecture to automatically respond to changing demand by scaling out or in. As a result, you pay for only the resources you use. You don’t have to worry about a lack of computing capacity to meet your customers’ needs`The AWS service that provides this functionality for Amazon EC2 instances is Amazon EC2 Auto Scaling.`.

## Amazon EC2 Auto Scaling
> enables you to automatically add or remove Amazon EC2 instances in response to changing application demand. 
> Within Amazon EC2 Auto Scaling, you can use two approaches: dynamic scaling and predictive scaling.

### 1. Dynamic scaling responds to changing demand. 
### 2. Predictive scaling automatically schedules the right number of Amazon EC2 instances based on predicted demand.

# Directing traffic with Elastic Load Balancing

### Elastic Load Balancing :+1: `is the AWS service that automatically distributes incoming application traffic across multiple resources, such as Amazon EC2 instances.`


# Messaging and queuing


### Monolithic applications and microservices

#### Monolithic :100: `Suppose that you have an application with tightly coupled components. These components might include databases, servers, the user interface, business logic, and so on. This type of architecture can be considered a monolithic application`

> In the Monolithic Approach if a single component fails, other components fail, and possibly the entire application fails.

#### Microservices :100: `application components are loosely coupled. In this case, if a single component fails, the other components continue to work because they are communicating with each other. The loose coupling prevents the entire application from failing.`

##### to services facilitate("يسهل") application integration :skin-tone-6: 
###### 1. Simple Notification service SNS
###### 2. Simple Queue service SQS





## Amazon Simple Notification Service (Amazon SNS)

> is a publish/subscribe service.
> Using Amazon SNS topics, a publisher publishes messages to subscribers.
> In Amazon SNS, subscribers can be web servers, email addresses, AWS Lambda functions, or several other options


# Additional compute services

### Serverless computing :u6709: `The term “serverless” means that your code runs on servers, but you do not need to provision or manage these servers. With serverless computing, you can focus more on innovating new products and features instead of maintaining servers`

> Another benefit of serverless computing is the flexibility to scale serverless applications automatically.
> Serverless computing can adjust the applications' capacity by modifying the units of consumptions, such as throughput and memory.
> An AWS service for serverless computing is AWS Lambda.


## aws lambda :u7981: `is a service that lets you run code without needing to provision or manage servers.`

### In AWS, you can also build and run containerized applications.

## Amazon Elastic Container Service :8ball: `s a highly scalable, high-performance container management system that enables you to run and scale containerized applications on AWS`

>Amazon ECS supports Docker containers. Docker 

## Elastic Kubernetes Service (Amazon EKS) :8ball: ` is a fully managed service that you can use to run Kubernetes on AWS. `

## AWS Fargate :a: ` is a serverless compute engine for containers. It works with both Amazon ECS and Amazon EKS`


