Supercharge Your Skills with Our Premium Plan! Unlock Unlimited Access to Essential Tech Courses for Just $19.99/Month.

What is Amazon Elastic Compute Cloud (Amazon EC2) in AWS?

Recent Posts

Pentesting for Web Applications

Pentesting for Web Applications

Introduction In today’s connected world, web applications are integral to business operations and user engagement. However, their popularity also makes them prime targets for cyberattacks.

Read More »
Share this post:

Table of Contents

Amazon Elastic Compute Cloud (Amazon EC2) in AWS

The resource offerings of Amazon Web Services continually change and it can become a challenge to stay on top of its development. It makes sense to start with EC2 when you’re new to AWS, as Amazon EC2 is one of the most popular and essential services of Amazon. But here’s the first question: What actually IS AWS EC2?

Okay, it’s an operating system in a computer with the hardware components of your choice. However, it is completely virtualised.

Amazon Elastic Compute Cloud (Amazon EC2) is a web service launched in 2006, that provides secure and resizable cloud-based computing capacity in the form of instances, which are virtual servers in the cloud. Amazon EC2 enables any developer to leverage the compute capacity that Amazon offers to meet their business requirements with no up-front investment and performance compromises. Amazon EC2 provides a pure virtual computing environment, where the web service interface can be used to launch instances with a range of operating systems, load custom application environment, manage network’s access permissions, and run the image, consuming as many or as few systems as desired.

Why AWS EC2?

Amazon EC2 offers the tools to build failure resilient applications and isolates itself from common failure scenarios. When designing a system, a good practice is to assume things will fail. In this way, you will always develop, implement and deploy with automatic recovery and restore strategy. With Amazon EC2, you can provision multiple instances at once, so that even if one of them goes down, the system will still be up and running.

EC2 is a compute-based service. It is not serverless. You are physically connected to a virtual server. You should always design for failure and provision at least one EC2 instance in each availability zone to avoid a system failure in case if any one instance goes down. It gives you a lot of benefits like auto scaling, pay as you go, increased reliability and elasticity.

EC2 Instance Types

In Amazon EC2, you have a broad variety of instance types that are optimized for different scenarios. Instance types consist of varying combinations of CPU, memory, storage, and networking capacity with one or more instance sizes giving you the flexibility to select computational resources according to the requirements of your targetted workload.

There are several types of AWS instances with different configurations and benefits.

  • General Purpose
  • Compute Optimized
  • Memory Optimized
  • Accelerated Computing
  • Storage Optimized
Family
Specialty
Use Cases
D2
Dense Storage
Fileservers/Data Warehousing/Hadoop
R4
Memory Optimized
Memory Intensive Apps/DBs
M4
General Purpose
Application Servers
C4
Compute Optimized
CPU Intensive Apps/DBs
G2
Graphics Intensive
Video Encoding/3D Application Encoding
I3
High-Speed Storage
NoSQL DBs, Data Warehousing, etc.
F1
Field Programmable Gate Array
Hardware Acceleration for your code
T2
Lowest cost, General purpose
Web Servers/Small DBs
P2
Graphics/General Purpose GPU
Machine Learning/ Bitcoins mining etc.
X1
Memory Optimized
SAP HANA/Apache Spark etc.
A1
General Purpose
Scale out workloads such as web servers, caching fleets
T3
Burstable General Purpose
Micro-services, virtual desktop
M5
General Purpose
Microsoft Sharepoint, Cluster computing, etc.
M5a
General Purpose
Running backend servers for SAP, Microsoft Sharepoint
T3a
General Purpose (Coming soon)
Development environment, code repositories etc.
C5
Compute Optimized
Compute intensive workloads such as High Performance Computing
C5n
Compute Optimized
HPC, video editing, etc.
R5
Memory Optimized
Memory intensive applications like high performance databases
R5a
Memory Optimized
Memory intensive applications such as real time big data analysis
X1e
Memory Optimized
High performance databases, in-memory databases, and memory intensive applications
High Memory
Memory Optimized
Large enterprise databases, production installation of SAP HANA
z1d
Memory Optimized
Electronic design automation
P3
Accelerated Computing
Machine deep learning, HPC
Table: Instance Types

Instance families are a collection of EC2 instances that are grouped according to the ratio of memory, network performance, CPU size and storage values to each other. For example, the m4 family of EC2 provides a balanced combination of computing, memory and network resources. Different instance type families are designed to accommodate different types of workloads, but they all have the same linear scale-up behavior within the family. 

On customer demands and needs, AWS occasionally introduces new instance families. You can check the list of latest instance families in AWS documentation.

Amazon Machine Images (AMIs)

The Amazon Machine Image (AMI) is a virtual server in the cloud that contains the original software that will be on the instance. AMI is the virtual server that initiates the instance. Users must specify the source AMI when the instance is launched. Multiple instances could be launched from a single AMI if the user is in need of various instances of the same configuration. Similarly, different AMIs could be used if the user needs instances of different settings.

An AMI includes the following:

  • The Operating System (OS) of the instance and its configuration
  • Launch permissions to control access, e., which AWS account can use the AMI to launch instances
  • Application/System Software

All AMIs are x86 OSs either Windows or Linux. There are four sources of AMIs, which are listed below:

  • Published by AWS:

Amazon Web Services (AWS) has released AMIs with different versions of operating systems, both Windows and Linux. These AMIs include multiple distributions of Linux (Ubuntu, Red Hat and Amazon’s distribution, etc.) and all versions of Windows server (2016, 2012 and others). If you launch an instance based on any of these AMIs, it will be using default OS settings similar to installing an OS from an ISO image. It is better to apply all patches immediately when you launch an instance with AWS published AMI.

  • The AWS Marketplace:

AWS Marketplace is an online store where customers can buy and use the software and its services that run on Amazon EC2. Many software vendors have made their products available in the AWS marketplace. That is beneficial in two ways; users do not need to install these software products, and the license terms are appropriate for the cloud. Instances that contains AWS marketplace AMIs incur the standard hourly instance type price and an additional per-hour charge for the other software (some open-source applications have no extra fees).

  • Generated from Existing Instances:

A common source of creating AMIs is to produce an AMI from an existing Amazon EC2 instance. Users can launch an instance with a published AMI and then configure it to meet all their standards; an AMI is then generated from the configured instance and used to create all instances of that OS. By doing this, all new instances are pre-configured according to the customer’s standards.

  • Uploaded Virtual Servers:

It is a familiar source for AMIs. Users can create machine images of various virtualization formats by using AWS VM Import/Export feature. Virtualization formats include raw, VHD, VMDK and OVA. If you want to find out the current list of Operating Systems, you can look up for that in the AWS documentation. It is necessary for the customers to stay compliant with the license terms of the operating system vendor.

Using an Instance Securely

When an EC2 instance is launched, it can be managed over the internet. AWS offers several ways to make sure that this management is safe and secure.

There are multiple ways that an instance can be addressed over the web, some of these are listed below:

·         Public Domain Name System (DNS)

Upon creation of an instance, AWS generates a Domain Name System (DNS) that can be used to access that instance. This DNS name is generated automatically; the user can not specify a name for this instance. This auto-generated name can be found in the description tab of the AWS management console or via the AWS Command Line Interface (CLI) or through the Application Programming Interface (API). This name only exists while the instance is running and cannot be transferred to any other instance.

·         Public IP

An instance may also have an IP address assigned. This address is assigned from AWS reserved addresses and cannot be specified by the user. The public IP address is a unique address and persists only while the instance is running and it cannot be transferred to any other instance.

·         Elastic IP

An elastic IP address is a unique address on the internet that has been reserved independently and associated with an Amazon EC2 instance. There are some critical differences between an Elastic IP and a Public IP. This IP address persists until the user releases it and it is not tied to the lifespan or state of the instance. It can also be transferred to a replacement instance in case of an instance failure. A public address can be shared externally without associating clients with a specific instance.

Block Storage Options

Amazon Instance Store is a cost-effective solution for specific workloads, but its limitations make it less suitable for many other assignments. For workloads that require a more durable storage, AWS offers Amazon Elastic Block Store (EBS). EBS is a virtual hard drive that can only be used with EC2.

It provides persistent block storage volumes to use with Amazon EC2 instances in the AWS Cloud. EBS enables you to create storage volumes that can only be attached to Amazon EC2 instances.  Instance store is a temporary storage, which is only available when the instance is running. The data of instance store is deleted if you stop or terminate the instance. You cannot use instance store with any instance because it is associated with one instance only whereas, EBS can be attached or detached from an instance and its storage is permanent. You can also create snapshots of EBS volume.

Instance store’s performance is better than that of EBS because it is a direct attached storage whereas EBS works over a network.

Pricing for EC2

There are four different pricing options for Amazon EC2 instances; the cost per hour varies for each of them. The four options are:

·         On-Demand Instances:

The per hour price for each instance type published on AWS represents the price for On-Demand instances. It requires no upfront commitments, and the user has control over when the instance is launched or terminated. This makes it the most flexible pricing option. It is the least cost-effective of the four pricing options, but the users can reduce cost by provisioning a variable level of computing for unpredictable workloads.

·         Reserved Instances:

Reserved Instances (RIs) enable users to reserve computing capacity for a predictable workload. Amazon EC2 standard RIs provide a significant discount (up to 75%) compared to the On-demand hourly rate, and convertible RIs provide a discount (up to 45%) compared to the On-demand hourly rate by changing the attributes of RIs as long as the exchange results in the creation of Reserved Instances are of equal or higher value. Amazon EC2 Scheduled RIs allow you to launch an instance in the time window, which you reserved to meet the reserved capacity with the predictable recurring schedule, this requires a portion of a day, a week or a month. When purchasing reservations, the user specifies the instance type required and an AZ for that Reserved Instance and achieves a lower effective hourly price for that instance for the duration of the reservation. A compute capacity in AWS data centers is reserved for the user. The factors determining the cost of RIs are the term commitment and payment option.

  • Term Commitment is the duration of the reservation. It can be from 1 to 3 years. The longer the commitment, the bigger the discount
  • There are different payment options for Amazon RIs;
  1. All Upfront:

    Pay the entire reservation charges in advance. There will be no monthly fee during the

  2. Partial Upfront:

    Pay a part of the reservation charges beforehand, and the rest will be paid in monthly

  3. No Upfront:

    Pay complete reservation charges in monthly

The more customer pays upfront, the more the amount of discount increases.

You can modify your reserved instances when your computing needs change; modification does not change the remaining term of the reservation. There is no fee for modification of RIs. The adjustment can be made in several ways, such as:

  • Switching Availability Zones within the same region
  • Changing between EC2-VPC and EC2-Classic
  • Changing the instance type within the same instance family (Linux instances only)
·         Spot Instances

Spot instances offer the greatest discounts for workloads that are not tied critical and interruption tolerant. Customers can specify the price they are willing to pay for a specific instance type. These instances will operate just like other instances, and the customer will pay the spot price for the hours that instances run. The instances will run until:

  • The user terminates them
  • The Spot price goes above the customer’s bidding price
  • The required computing capacity is not available

If Amazon needs to terminate a spot instance, a notice of termination will be received, providing a two-minute window before Amazon terminates the spot instance. Because of the possibility of interruption, it is recommended that spot instances should be used for interruption-tolerant workloads. This could include analytics, financial modeling, big data, media encoding, scientific computing, and testing.

·         Dedicated Hosts

An EC2 dedicated host is a server with Amazon EC2 instance capacity entirely dedicated to a single user’s use, which means it is not a multi-tenant virtualization. Dedicated hosts help users reduce cost by allowing them to use their existing server-bound software licenses. It can be purchased on-demand or as a reservation for up to 70% off the on-demand price. Dedicated hosts are different from dedicated instances in a way that dedicated instances can be launched on any hardware that is dedicated to an account.

Use Case

An enterprise wants to host its application, which has high compute capacity on cloud. The application has dynamic and scalable environment, so as per requirement, they need to switch the server on and off as they are currently testing the application.

Solution

By using EC2 compute service of an AWS, they can host their application with their desired size of RAM and CPU.

Step-by-Step Guide

Step no. 1: Login to AWS management console and go to “Services”, then click “EC2” under Compute.
Step no. 2: On EC2 dashboard, click “Launch Instance” button.
Step no. 3: Select “Amazon Linux AMI”.
Step no. 4: Select “t2 micro” and click “Next: Configure Instance Details”.
Step no. 5: Click “Next: Add Storage”.
Step no. 6: Click “Next: Add tags”.
Step no. 7: Click “Next: Configure Security Groups”.
Step no. 8: Click “Review and Launch”.
Step no. 9: You will see a security warning, ignore and click “Launch”.
Step no. 10: Create key pair by selecting “Create a new key pair” and downloading the key pair; it will be in the .pem format. Launch the instance.
Step no. 11: EC-2 launched status.
Step no. 12: Click “View Instances” to go back to see the launch status of your instance.
Step no. 13: This option is only for Windows User. Download the puTTY.exe file from the link “https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html”.
Then open PuTTYgen from downloads and click “Load”.
Step no. 14: Load “.pem” file by changing the format type in “all files”.
Step no. 15: A pop-up will open. Select “Ok”.
Step no. 16: Save the private key. Putty is used to converting the .pem file in the .ppk file.
Step no. 17: A pop-up window will appear to ask you whether you want to save the key without protection. Press “Yes” and save the key in the folder.
Step no. 18: Open Putty application, go to “SSH” and then go to “Auth”.
Click “Browse”.
Step no. 19: Add a key in a .ppk format, which you must save through Puttygen.
Step no. 20: Go to “Session”. Enter “Hostname or IP address” and in “Saved Sessions”, insert the public IP of the instance.
Step no. 21: Go to the instance and take the public IP of that instance.
Step no. 22: Add the public IP in “Host Name” and save the session.
Step no. 23: Click “Save”. The IP is shown in default settings. Select the IP and then press “Open”.
Step no. 24: The Putty window will open and prompt you for a username. Press “Yes” and write “ec2-user” then press “Enter”. Now, login to your Amazon Linux 2 AMI machine.

Conclusion

In this blog, we discussed about the AWS Compute Service that is EC2, which is also the backbone of AWS. With the use of this service, you can get resizable compute service in cloud. We described the different types of instances offered by AWS. We also learned how to launch an instance on EC2 and how to connect it (for windows users only). In conclusion, we can confidently say that with the use of this service, you will be able to create a server for your application easily within a few minutes.

Now if you are still confused about how and where to get started, then IPSpecialist is the place for you. What is IPSpecialist you ask? IPSpecialist is a one-stop solution for all your problems. We provide online courses, study guides, e-book, practice questions, quick reference sheets, and much more! Visit our website https://ipspecialist.net/ to learn more and get amazing deals!

Good luck and happy learning

Sign-Up with your email address to receive news, new content updates, FREE reports and our most-awaited special discount offers on curated titles !

Loading

Sign-Up with your email address to receive news, new content updates, FREE reports and our most-awaited special discount offers on curated titles !

Loading

Sign-Up with your email address to receive news, new content updates, FREE reports and our most-awaited special discount offers on curated titles !

Loading