AWS Elastic Compute Cloud(EC2) is a web service that provides resizable compute capacity in the cloud.
EC2 Instance Type:
We have 7 types of EC2 Instance like – General Purpose, Compute Optimized, etc. as seen below:
EC2 Pricing Models:
On Demand:
Highest cost among others, but no upfront commitment, billed by second.
Recommended for short-term uninterrupted work where you don’t know how the application will behave.
Reserved:
Upto 70% discount compared to “On Demand” since you are reserving a instance for 1 or 3 year.
Recommended for databases.
Spot:
Since you bid for the price you get up to 90% discount compared to “On Demand”. But the risk is you will loose the instance once the spot instance price goes above your max price.
Recommended for works that are resilient to failures / having flexible start or end time, like – Image processing, Data analysis, small batch jobs, etc.
If the Spot instance is terminated by Amazon you will not be charged. But if you terminate it then you will be charged for any hour in which the instance ran.
Dedicated:
A physical server hardware is dedicated for you only. You can pay by per second (On-Demand) or 1 / 3 years (Reserved). Most expensive option.
Dedicated Hosts: is required when you want to have a control over the instances. When a user wants to utilize their existing per-socket, per-core or per-virtual machine software licences for a server running on AWS.
AWS ENI (Elastic Network Interfaces) :
- ENI is a logical component in a VPC that represents a virtual network card.
- ENI can have the following attributes:
- It has a one public IP.
- It has a primary private IP and one or more secondary IPs.
- It has one Elastic IP per private IP.
- One or more security groups.
- A MAC address.
- You can create an ENI independently and can later attach to other EC2 instances (on the fly). This behavior is helpful in the case of a fail over, where you can change the primary EC2 instance to another fail over instance.
- In the below diagram Eth0, Eth1 are the ENIs:
If one of your instances serving a particular function fails, its network interface can be attached to a replacement or hot standby instance pre-configured for the same role in order to rapidly recover the service. For example, you can use a network interface as your primary or secondary network interface to a critical service such as a database instance or a NAT instance. If the instance fails, you (or more likely, the code running on your behalf) can attach the network interface to a hot standby instance.
Because the interface maintains its private IP addresses, Elastic IP addresses, and MAC address, network traffic begins flowing to the standby instance as soon as you attach the network interface to the replacement instance. Users experience a brief loss of connectivity between the time the instance fails and the time that the network interface is attached to the standby instance, but no changes to the route table or your DNS server are required.