More About Amazon EC2 Service: Part 2

More About Amazon EC2 Service: Part 2

Exploring EC2 Instance Families:

1) "M" (m4,m5,m6): General Purpose

- Details: Balance of compute (CPU), memory & networking.

- Use Case: Web Servers and Code Repositories

2) "T" (t2, t3, t3a) : Burstable Performance Instance

- Details: Accumulate CPU credits when inactive, meaning when the instance is inactive then CPU credits will be increased and when there is a sudden spike in the traffic then those CPU credits will be utilized to handle that traffic.

- Use Case: Workloads with spikes, web server, test environment, small db

3) "C" (c4,c5,c5n): Compute Optimized

- Details: When there is a need for high performance with min latency.

- Use Case: Batch processing, High-performance http servers, high-performance computing

4) "R" (r4, r5, r5a, r5n): Memory (RAM) Optimized

- Details: In this instance family we will be having a lot of RAM

- Use Case: Memory caches, In-Memory DB & Real-time big data analytics.

5) "I" (i3, d2): Storage Optimized

- Details: In this instance family we will be having a lot of storage to handle large data

- Use Case: NoSql DB & Data warehousing

EC2 Tenancy Models:

When we create an EC2 instance, then that instance will be put on some host machine somewhere in the data centers, now some other enterprises can also use the cloud providers to create virtual machines using EC2 service and those created ec2 instances might be placed on the same host where our ec2 instances were placed earlier, so to overcome this situation we can opt for dedicated hosts to avoid sharing of hosts to other enterprises & this can be achieved by deciding the tenancy models while creating an ec2 instance
The Default Tenancy Is Shared.

Shared Tenancy: Default

  • A single host machine can have instances from multiple customers.

Dedicated Instances:

  • Instances will be placed on dedicated hardware which will be belonging to one customer.

  • Customer won't be having visibility into the hardware of the underlying host.

  • Billing: Per Instance

  • Note: We can't decide the host on which the instance will be placed but it will ensure that the underlying host won't be having instances from other customers.

Dedicated Host:

  • Instances will be placed on dedicated hardware which will be belonging to one customer.

  • Customer will be having visibility into the hardware of the underlying host (Sockets & Physical Cores)

  • Use Case: Server-bound software licenses like Windows server, SQL server

  • Billing: Per host

  • Note: Here we can decide the EC2 instance placement like on which host it needs to be placed.

EC2 Placement Groups:

In certain use cases, we need to have control over the placement of a group of EC2 instances.

1) An example would be, suppose we want low latency network connection among EC2 instances, now suppose our EC2 instances are spread across multiple hosts then there will be some latency in network connections so to avoid this case, we can place those EC2 instances on a single host.

2) Second Example of having control over the placement of EC2 instances is we want high availability i.e if we want to avoid simultaneous failures of EC2 instances we can provision them on multiple hosts so that if one host goes down due to any issues the requests will be served by other instances places on a different host.

Placement Group Types:

1) Cluster: Used for low network latency use cases. Ex- Big Data or High-performance computing with very low network latency.

2) Spread: To avoid simultaneous failures i.e (High Availability), we can only have a max of seven running instances per AZ in the spread placement group.

3) Partition: Multiple partitions with low network latency and would be placed across different hosts or different racks. It's a combination of Cluster + Spread placement groups. Partition is nothing but a group of EC2 instances. We can have a max of seven partitions per AZ in the partition placement group.

Note: You can create a placement group under "Network & Security" section inside EC2 dashboard and then can use that placement group while launching the EC2 instance.

1)

2)

Elastic Network Interface:

The EC2 instance has a public IP address and a private IP address which will be used by other EC2 instances to communicate with each other.
These IP addresses are allocated to EC2 instances by ENI i.e Elastic Network Interface.

The ENI supports both IPV4 and IPV6 addresses.

Each Elastic Network Interface Can Provide:

  • One primary & multiple secondary private IPs

  • One public IP address

  • One elastic IP per private IP

  • One or more security groups

There are two ENI i.e Primary & Secondary, each EC2 instance is connected to primary network interface i.e (eth0). We can create a secondary network interface and attach it to the EC2 instance i.e (eth1), this allows an instance to be dual-homed i.e it will be present in two subnets in a VPC.

ENI Terminologies:

  • Hot Attach: Attaching ENI when the EC2 instance is running.

  • Warm Attach: Attaching ENI when the EC2 instance is stopped.

  • Cold Attach: Attaching ENI while launching the EC2 instance.