EC2 (Elastic Compute Cloud)

 EC2 (Elastic Compute Cloud)


___________________________________________________________________________________

Introduction to EC2  -
  • Amazon Elastic Compute Cloud (Amazon EC2) is a computing capacity that is scalable in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates the need to invest in hardware upfront, allowing you to develop and deploy applications more quickly
  • With Amazon EC2 you launch virtual server instances on the AWS cloud. Each virtual server is known as an “instance”
Features of EC2 - 
  • Instances are virtual computing environments.
  • Amazon Machine Images (AMIs) are preconfigured templates for your instances that package the bits you need for your server (including the operating system and additional software). AMI is a ISO file
  • Instance types are different configurations of CPU, memory, storage, and networking capacity for your instances
  • Using key pairs, you can secure login information for your instances (AWS stores the public key, and you store the private key in a secure place)
Amazon EC2 currently supports a variety of operating systems including:
  • Amazon Linux.
  • Ubuntu.
  • Windows Server.
  • MacOS.
  • Red Hat Enterprise Linux.
  • SUSE Linux Enterprise Server.
  • Fedora.
  • Debian.
  • CentOS.
  • Gentoo Linux.
  • Oracle Linux.
  • FreeBSD  

___________________________________________________________________________________

EC2 Instance Types - 
  • Amazon EC2 provides a wide selection of instance types optimized to fit different use cases.
  • Instance types comprise varying combinations of CPU, memory, storage, and networking capacity and give you the flexibility to choose the appropriate mix of resources for your applications.
  • Each instance type includes one or more instance sizes, allowing you to scale your resources to the requirements of your target workload


 

Category

Purpose

General Purpose

General Purpose Instances provide a balance on compute, memory, and networking resources, and can be used for a variety of diverse workloads

Compute Optimized

Compute optimized are ideal for compute bound applications that benefit from high performance processors

Memory Optimized

Memory optimized instances are designed to deliver fast performance for workloads that process large data sets in memory

Accelerated Computing

Accelerated Computing instances use hardware accelerators, or co-processors to perform functions such as floating-point number calculations, graphics processing, or data pattern matching

Storage Optimized

This instance family provides Non-Volatile Memory Express (NVME) SSD-Backed instance storage optimized for low latency, very high random I/O performance, high sequential read throughput and high IOPS at a low cost

 

___________________________________________________________________________________

What is AMI ? - 

An Amazon Machine Image (AMI) provides the information required to launch an instance.

An AMI includes the following:

  • A template for the root volume for the instance (for example, an operating system, an application server, and applications).
  • Launch permissions that control which AWS accounts can use the AMI to launch instances.
  • A block device mapping that specifies the volumes to attach to the instance when it’s launched.

AMIs are regional. You can only launch an AMI from the region in which it is stored. However, you can copy AMIs to other regions using the console, command line, or the AP 


___________________________________________________________________________________

Security Groups - 

  • Security groups are fundamental of network security in AWS 
  • They control how traffic is allowed into or out of EC2 instance
  • Security groups only contain rules
  • Security groups can reference by IP or security groups
  • Security groups are like a firewall that allows ports and IP addresses and deny unwanted ports and IP addresses 



Ports

Description

20 and 21

FTP – File Transfer Protocol

22

SSH – Secure Shell

25

SMTP – Simple Mail Transfer Protocol

53

DNS – Domain Name System

80

HTTP – Hyper Text Transfer Protocol

123

NTP – Network Time Protocol

179

BGP – Border Gateway Protocol

443

HTTPS – HTTPS Secure

500

ISAKMP – Internet Security Association & key Management Protocol

587

SMTP – Modern SMTP

3389

RDP – Remote Desktop Protocol


___________________________________________________________________________________

Public IP vs Elastic IP - 



___________________________________________________________________________________

EC2 Purchasing Options - 

On-Demand - 
  • Pay for what you use
  • Linux or Windows - billing per second after the first minute
  • All other OS - billing per hour
  •  It has the highest cost but no upfront payment
  • No long-term commitment
  • Recommended for short term and un-interrupted workloads where you can't predict the how application will behave 
  • ideal for auto-scaling and unpredictable workloads

Reserved Instances - 
  • Up to 72% discount compared to on-demand
  • You reserve specific instance attributes (instance type, region, tenancy, os)
  • Reservation period - 1 year(+discount) or 3 years(+++discount)
  • Payment option - No upfront(+), partial upfront(++), all upfront(+++)
  • Reserved Instances Scope - Regional or Zonal 
  • Recommended for steady-state usage applications (eg. database)
  • You can buy or sell in the reserved instance marketplace 
  • Convertible Reserved Instance  - Can change the instance type, instance family, OS, scope, and tenancy. Up to 66% discount

Spot Instances - 
  • Can get discounts up to 90% compared to on demand
  • Instances that you can "lose" at any point of time if your max price is less that current spot price
  • The most cost-efficient instances in AWS
  • Useful for workloads that are resilient to failure - batch jobs, data analysis, image processing, any distributed workloads, workloads with a flexible start and end time
  • not suitable for critical jobs or databases



Dedicated Hosts - 
  • Physical servers dedicated just for your use
  • You then have control over which instances are deployed on that host
  • Available as on-demand or with a dedicated hosts reservation
  • Useful if you have server-bound software licenses that use metrics like per-core, per-socket, per-VM
  • Each dedicated host can run only on instance size and type
  • Good for regulatory compliance or licensing requiremnets
  • Predictable performance
  • Complete isolation
  • Most expensive option
  • Billing is per host


Dedicated Instances - 
  • Virtualized instances on hardware just for you
  • Also uses physically dedicated EC2 servers
  • Does not provide additional visibility and controls of dedicated host 
  • Billing is per instance 
  • May share hardware with other non-dedicated instances in the same account
  • Available as on-demand, reserved instances, spot instances
  • Cost additional $2 per hour per region

Capacity Reservations - 
  • Reserve on-demand instances capacity in a specific AZ for any duration 
  • You always have access to EC2 capacity when you need it 
  • No time commitment (create/cancel anytime), no billing discount
  • Combine with regional reserved instances and saving plans to benefit from billing discount
  • You are charged at on-demand rate whether you run instances or not
  • Suitable for short-term, uninterrupted workloads that need to be in a specific AZ

How to choose a purchasing option ??? - 

Let's understand these concepts of purchasing options by taking the example of booking a resort
  • On-demand - coming and staying in a resort whenever we like, we pay the full price
  • Reserved instances - like planning ahead and if we plan to stay for a long time, we may get a good discount
  • Spot instances - the hotel allows people to bid for the empty room and the highest bidder keeps the rooms but can get kicked out anytime if anyone gives high price than them
  • Dedicated hosts - we book an entire building of the resort 
  • Capacity reservations - you book a room for a period with full price even if you don't stay

___________________________________________________________________________________

Elastic Network Interfaces (ENI) - 

  •  An elastic interface network is a logical networking component in a VPC that represents a virtual network card.
  • A network interface can include the following attributes - 
  1. A primary IPv4 address from the IPv4 address range of your VPC
  2. One or more secondary private IPv4 address from the IPv4 address range of your VPC
  3. One elastic IP address
  4. one public IPv4 address
  5. One or more IPv6 addresses
  6. One or more security groups
  7. A mac address
  • You cannot increase the network bandwidth of an instance by teaming multiple ENIs
  • eth0 is the primary network interface and cannot be moved or detached its a by default only ENI when instance is launched
  • An ENI is bound to an AZ, and you can specify which subnet /AZ you want to ENI to be added

 


___________________________________________________________________________________


Hibernation of EC2 - 
  • Hibernation saves the content from RAM to EBS root volume
  • The EBS root volume is restored to its previous state
  • The RAM contents are reloaded
  • The processes that were previously running on the instance are resumed 
  • Previously attached data volumes are reattached and the instance retain its instance id




Networking  - 



  • That's all for EC2 guys please email if you have any corrections, additions, queries or to discuss something about the above points. EMAIL - mahajanrohit759@gmail.com
  • Please share it with your friends
  • In the next post, we will discuss about ELB (Load Balancers)

Comments

Popular posts from this blog

AWS Instance Store

AWS Identity and Access Management

Elastic Block Storage (EBS)