What is an Amazon EC2 Instance? Types, features and pricing
What is an Amazon EC2 instance?
An Amazon EC2 instance is a virtual server in Amazon's Elastic Compute Cloud (EC2) scalable compute platform for running applications on the Amazon Web Services (AWS) cloud. Amazon EC2 provides various types of instances of different sizes, with each comprising different configurations of central processing unit (CPU), memory, storage and networking resources to suit user needs and workloads.
Amazon EC2 and Amazon EC2 instances
AWS is a comprehensive and evolving public cloud computing environment that offers more than 200 services from dozens of data centers around the world. Amazon EC2 is one such service. It is a compute platform that provides on-demand, scalable computing capacity through instances for different enterprise applications and workloads.
Within Amazon EC2, an instance is a virtual server in the AWS cloud. To launch an instance, a user needs to use an Amazon Machine Image (AMI), which are like templates and contain an operating system (OS) and other software that determine the user's operating environment. Users can select an AMI provided by AWS or the AWS developer community as well as through the AWS Marketplace. Users also can create their own AMIs if they need to start new instances for their specific requirements.
An instance is a copy of the AMI in the AWS cloud. When launched, its configuration is a copy of the AMI that was specified at the time of launch. Once an instance is created in Amazon EC2, it runs until the user stops, hibernates or terminates it. Stopped instances can be restarted; terminated instances get deleted and cannot be restarted.
An instance type determines the hardware of the host computer used for that instance. AWS provides six instance types: general purpose, compute optimized, memory optimized, storage optimized, accelerating computing, and high-performance computing (HPC) optimized.
Users can select the instance type depending on the amount of memory and computing power required for their specific application. After launching the instance, they can control it and use sudo to run commands that require root privileges.
Amazon EC2 instance types
Here are Amazon EC2's six instance types.
General purpose
Amazon EC2 general-purpose instances can handle a variety of workloads. They provide a balance of compute, memory and networking resources, making them ideal for applications such as code repositories, web applications, microservices, small and medium databases and web servers.
As of April 2024, Amazon EC2 supports 19 general-purpose instances, powered by different processor types, such as Arm-based AWS Graviton3 processors, 4th Generation Intel Xeon Scalable processors and third-generation AMD EPYC processors. All general purpose instances are optimized for Elastic Block Storage -- they can fully use the input/output operations per second (IOPS) provisioned on an EBS volume -- and incorporate the Enhanced Networking feature, which provides high packet-per-second performance, lower network jitter and lower latencies.
Compute optimized
Compute-optimized instances are used to run compute-intensive applications that require large amounts of processing power and memory on the AWS cloud. Some of these instances deliver the best price performance in Amazon EC2, while others offer high packet processing performance per virtual CPU (vCPU).
Workloads and applications supported by compute optimized instances include batch processing, scientific modeling, gaming servers, HPC, machine learning, distributed analytics, video encoding and ad serving.
Graphics processing unit
GPU instances provide a way to run graphics-intensive applications faster than with the standard EC2 instances. Systems that rely on GPUs include gaming and design work. For example, Linux distributions often take advantage of GPUs for rendering graphical user interfaces, improving compression speeds and speeding up database queries.
Memory optimized
Memory optimized instances are larger in size with more memory and vCPUs than other types of instances. Some instances feature DDR5, or Double Data Rate 5, memory that offers more bandwidth than DDR4 memory. Others include discrete in-memory analytics accelerators that enable efficient offload, accelerate data operations, and optimize performance for many types of memory-intensive workloads.
These instances are ideal for workloads that process large data sets in memory. These include open source databases; real-time big data analytics; in-memory caches; electronic design automation; financial simulations; and SAP, Structured Query Language and NoSQL databases.
Storage optimized
Storage-optimized instances are ideal for applications that require high IOPS, specifically, high sequential read/write access to large data sets on local storage. Some of these instances provide excellent price performance for storage-intensive workloads in Amazon EC2, some offer very low cost per terabyte of solid state drive storage, and others deliver high local storage performance in Amazon EC2.
All storage optimized instances deliver tens of thousands of low-latency, random IOPS. For this reason, they are suitable for applications like real-time analytics, transactional databases, relational databases, NoSQL databases, search engines, data streaming and large distributed file systems.
Accelerating computing
Accelerated computing instances on Amazon EC2 perform many types of functions more efficiently than software running on CPUs. These GPU-based instances use hardware accelerators or co-processors to perform functions like floating point number calculations, graphics processing and data pattern matching.
Deep learning, generative AI, and HPC workloads are well-suited for accelerated computing instances. These instances also provide excellent performance for applications such as seismic analysis, weather forecasting, computational finance, financial modeling, speech recognition, autonomous vehicles, and computational fluid dynamics (CFD).
HPC optimized
As the name suggests, HPC instances are optimized for running HPC applications at scale while offering the best price performance. Applications that require high-performance processors can best benefit from these instances, including deep learning workloads, complex simulations, CFD, weather forecasting, multiphysics simulations, finite element analysis for crash simulations, and structural simulations.
Micro
A micro instance is meant for applications with low throughput. The micro instance type can serve as a small database server, as a platform for software testing or as a web server that does not require high transaction rates.
Amazon EC2 instance features
Amazon EC2 instances enable enterprise users to deploy, manage and scale a wide variety of applications. The following are Amazon EC2 instance features:
- Multiple storage options. Users can select from multiple storage options including block level storage (Amazon EBS), instance storage and object storage (Amazon Simple Storage Service 3). Furthermore, Amazon EBS provides three volume types to suit different types of workloads: General Purpose, Provisioned IOPS and Magnetic.
- Support for using the IOPS provisioned on an EBS volume. Amazon EC2 provides EBS-optimized instances that deliver dedicated throughput between Amazon EC2 and Amazon EBS to provide improved performance for EBS volumes.
- Cluster networking. Some EC2 instances support low-latency cluster networking, making them ideal for high performance analytics systems, and many science and engineering applications.
- Processor features. Amazon EC2 instances with Intel processors can access additional features. These include Intel Advanced Encryption Standard Instructions for faster data protection and greater security, Intel Advanced Vector Extensions to improve performance for floating-point-intensive applications, Intel Turbo Boost Technology to boost performance as needed and Intel DL Boost for AI deep learning use cases.
- Operating system. EC2 supports many OSes, including Linux, Microsoft Windows Server, CentOS and Debian.
- Persistent storage. Amazon's EBS service lets users attach enables block-level storage volumes to EC2 instances and be used as hard drives. With EBS, it is possible to increase or decrease the amount of storage available to an EC2 instance and attach EBS volumes to more than one instance at the same time.
- Elastic IP addresses. Amazon's Elastic IP service lets users associate IP addresses with an instance. Elastic IP addresses can be moved from instance to instance without requiring a network administrator's help. This makes them ideal for use in failover clusters, for load balancing or for other purposes where there are multiple servers running the same service.
- Amazon CloudWatch. This web service helps users monitor AWS cloud services and applications deployed on AWS. CloudWatch can be used to collect, store and analyze historical and real-time performance data. It can also proactively monitor applications, improve resource use, optimize costs, and scale up or down based on changing workloads.
- Automated scaling. Amazon EC2 Auto Scaling automatically adds or removes capacity from Amazon EC2 virtual servers in response to application demand. Auto Scaling provides more capacity to handle temporary increases in traffic during a product launch or to increase or decrease capacity based on whether use is above or below certain thresholds.
- Bare-metal instances. These virtual server instances consist of the hardware resources, such as a processor, storage and network. They are not virtualized and do not run an OS, reducing their memory footprint, providing extra security and increasing their processing power.
- Amazon EC2 Fleet. This service lets users deploy and manage instances as a single virtual server. The Fleet service makes it possible to launch, stop and terminate EC2 instances across EC2 instance types with one action. Amazon EC2 Fleet also provides programmatic access to fleet operations using an API. Fleet management can be integrated into existing management tools. With EC2 Fleet, policies can be scaled to automatically adjust the size of a fleet to match the workload.
- Pause and resume instances. EC2 instances can be paused and resumed from the same state later. For example, if an application uses too many resources, it can be paused without incurring charges for instance usage.
Amazon EC2 instance pricing
Enterprise users can pay for Amazon EC2 instances in various ways:
On-demand
On-demand instances are charged by the hour or second. No long-term commitments are required. This pricing plan is suitable for users who need to use Amazon EC2 without having to make upfront payments as well as for applications that have unpredictable workloads or are being developed on EC2 for the first time.
Savings plans
This pricing model is suitable for users looking to save money or need compute offerings for committed and steady-state usage. It can help users to reduce their EC2 bills compared to the on-demand plan. However, it requires a one- or three-year usage commitment.
Reserved instances
Like savings plans, a reserved instance also provides a discount over on-demand instances. It also requires a one- or three-year usage commitment for standard or convertible reserved instances. Payments can be made up front or at a discounted hourly rate.
Spot instances
Amazon EC2 spot instances are available at a discount compared to on-demand instances. "Spot" literally refers to the spot price that's in effect for the period when the instances are running. This plan is suitable for fault-tolerant or stateless workloads, applications with flexible start and end times, and applications running on heterogenous hardware.
Amazon EC2 burstable performance instances
Amazon EC2 users can choose between fixed performance instances and burstable performance instances depending on their application and workload requirements. The latter type provides baseline CPU performance levels with the additional ability to burst above that baseline.
When an instance runs at higher CPU utilization for a prolonged period, AWS charges a small additional fee. This is a flat charge that's calculated per vCPU hour. The ability of instances to burst is governed by CPU credits that provide the performance of a full CPU core for one minute.
The cloud cost model can be challenging. Find out the steps to take to effectively manage AWS costs, including EC2 instances; identify ways to save; and keep your cloud costs in check. Explore how to use the AWS Command Line Interface to create an EC2 instance. Learn how to launch an EC2 instance using Terraform.