AWS EC2 Instance Types: Everything You Need to Know
Last updated on 13th Jun 2020, Blog, General
What is Amazon EC2?
Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.
Features of Amazon EC2
Amazon EC2 provides the following features:
- Virtual computing environments, known as instances
- Preconfigured templates for your instances, known as Amazon Machine Images (AMIs), that package the bits you need for your server (including the operating system and additional software)
- Various configurations of CPU, memory, storage, and networking capacity for your instances, known as instance types
- Secure login information for your instances using key pairs (AWS stores the public key, and you store the private key in a secure place)
- Storage volumes for temporary data that’s deleted when you stop or terminate your instance, known as instance store volumes
- Persistent storage volumes for your data using Amazon Elastic Block Store (Amazon EBS), known as Amazon EBS volumes
- Multiple physical locations for your resources, such as instances and Amazon EBS volumes, known as Regions and Availability Zones
- A firewall that enables you to specify the protocols, ports, and source IP ranges that can reach your instances using security groups
- Static IPv4 addresses for dynamic cloud computing, known as Elastic IP addresses
- Metadata, known as tags, that you can create and assign to your Amazon EC2 resources
- Virtual networks you can create that are logically isolated from the rest of the AWS cloud, and that you can optionally connect to your own network, known as virtual private clouds (VPCs)
How to get started with Amazon EC2?
First, you need to get set up to use Amazon EC2. After you are set up, you are ready to complete the Getting Started tutorial for Amazon EC2. Whenever you need more information about an Amazon EC2 feature, you can read the technical documentation.
Sign up for AWS
When you sign up for Amazon Web Services (AWS), your AWS account is automatically signed up for all services in AWS, including Amazon EC2. You are charged only for the services that you use.
- With Amazon EC2, you pay only for what you use. If you are a new AWS customer, you can get started with Amazon EC2 for free. For more information, see AWS Free Tier.
- If you have an AWS account already, skip to the next task. If you don’t have an AWS account, use the following procedure to create one.
To create an AWS account
- Open https://portal.aws.amazon.com/billing/signup.
- Follow the online instructions.
Part of the sign-up procedure involves receiving a phone call and entering a verification code on the phone keypad.
Create a key pair
AWS uses public-key cryptography to secure the login information for your instance. A Linux instance has no password; you use a key pair to log in to your instance securely. You specify the name of the key pair when you launch your instance, then provide the private key when you log in using SSH.
If you haven’t created a key pair already, you can create one using the Amazon EC2 console. Note that if you plan to launch instances in multiple Regions, you’ll need to create a key pair in each Region. For more information about Regions, see Regions, Availability Zones, and Local Zones.
You can create a key pair using one of the following methods.
- New console
- Old console
To create your key pair
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the navigation pane, choose Key Pairs.
- Choose Create key pair.
- For Name, enter a descriptive name for the key pair. Amazon EC2 associates the public key with the name that you specify as the key name. A key name can include up to 255 ASCII characters. It can’t include leading or trailing spaces.
- For File format, choose the format in which to save the private key. To save the private key in a format that can be used with OpenSSH, choose pem. To save the private key in a format that can be used with PuTTY, choose ppk.
- Choose Create key pair.
- The private key file is automatically downloaded by your browser. The base file name is the name you specified as the name of your key pair, and the file name extension is determined by the file format you chose. Save the private key file in a safe place.
This is the only chance for you to save the private key file.
- If you will use an SSH client on a macOS or Linux computer to connect to your Linux instance, use the following command to set the permissions of your private key file so that only you can read it.
- chmod 400 my-key-pair.pem
- If you do not set these permissions, then you cannot connect to your instance using this key pair. For more information, see Error: Unprotected private key file.
To create a security group with least privilege
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- From the navigation bar, select a Region for the security group. Security groups are specific to a Region, so you should select the same Region in which you created your key pair.
- In the navigation pane, choose Security Groups.
- Choose Create security group.
- In the Basic details section, do the following:
- Enter a name for the new security group and a description. Use a name that is easy for you to remember, such as your user name, followed by _SG_, plus the Region name. For example, me_SG_uswest2.
- In the VPC list, select your default VPC for the Region.
- In the Inbound rules section, create the following rules (choose Add rule for each new rule):
- Choose HTTP from the Type list, and make sure that Source is set to Anywhere (0.0.0.0/0).
- Choose HTTPS from the Type list, and make sure that Source is set to Anywhere (0.0.0.0/0).
- Choose SSH from the Type list. In the Source box, choose My IP to automatically populate the field with the public IPv4 address of your local computer. Alternatively, choose Custom and specify the public IPv4 address of your computer or network in CIDR notation. To specify an individual IP address in CIDR notation, add the routing suffix /32, for example, 203.0.113.25/32. If your company allocates addresses from a range, specify the entire range, such as 203.0.113.0/24.
- Warning: For security reasons, we don’t recommend that you allow SSH access from all IPv4 addresses (0.0.0.0/0) to your instance, except for testing purposes and only for a short time.
- Choose Create security group.
EC2 Instance Type
Type: General Purpose
General Purpose instances are the most widely used and are a good first step if you’re new to AWS or cloud computing in general. They offer a great mix of cost and functionality, with their typical use being geared towards web servers, running development environments for your mobile or gaming apps, and running enterprise applications such as CRMs and ERPs. You’ll find that one of the main distinctions within this class is between instances with Fixed vs. Burstable performance. With Burstable performance EC2s, you’ll have the ability to quickly scale up your compute power — at a price.
General Purpose: A1
A1 instances are general use but differentiate themselves by being an ARM-based offering, as opposed to Intel or AMD. As such, this platform will appeal more to the ARM development community and to applications that already run open source software such as Java and Python and the multiple architectures these tend to support.
General Purpose: M5
M5 instances run on Intel Xeon processors and are thus suited to developing on the x86 architecture. They offer higher compute, memory, and network performance when compared to the A1.
M5 instances are great for development and test environments as well as web servers. They also offer support for Intel AVX-512, a set of CPU instructions that benefits the processing of encryption algorithms, so these instances are a great choice when security is important while not affecting performance.
General Purpose: T3 and T3a
T3 and T3a are respectively the Intel and AMD offerings of Burstable performance instances. Burstable performance instances are great if you want a cheaper and slightly less powerful offering than a fixed performance instance (like an M5), but you still want the option to be able to scale up your compute quickly to handle workloads, hence the “bursts” in power.
These bursts of power don’t come for free — they’re handled by CPU credits. In general, when you are not running at maximum processing power, you earn CPU credits. The amount you earn depends on the time at a low threshold and the size of your instance. When you need to burst up, these credits are spent.
Type: Compute Optimized
Compute Optimized: C5
C5 instances are ideal for applications where you prioritize raw compute power, such as gaming servers, scientific modeling, high-performance web servers, and media transcoding. C5 instances run on Intel Xeon Platinum processors and are benchmarked at 25% faster than previous-generation C4 instances — a clear example of the benefits of generational improvement in cloud resources.
Best AWS EC2 Training with Advanced Concepts from Real Time Experts
- Instructor-led Sessions
- Real-life Case Studies
Type: Memory Optimized
Memory Optimized: R5 & R5a
R5 and R5a are respectively the Intel and AMD offerings of “regular” memory optimized instances. These instances are ideal for memory intensive applications such as real-time big data analytics, large in-memory caches, and high-performance databases. The R5 and R5a instances benefit from the AWS Nitro System, which gives you access to almost all of the compute and memory resources of a server (i.e. allocating as little as possible to the OS). This optimization allows for lower cost when compared on a per-GiB basis to competitors.
Memory Optimized: X1 & X1e
X1 and X1e instances are optimized to provide a high ratio of memory to compute with the X1e family delivering the highest memory to compute ratio among EC2 offerings. These instances are used for the highest need memory-intensive applications such as SAP HANA, providing a strong foundation for real-time applications.
Memory Optimized: High Memory instances
High Memory instances have the greatest amount of available RAM, providing 6 TB, 9 TB, or 12 TB of memory in a single instance. Like X1/X1e, these are suited to production deployments of hugely memory intensive, real-time databases such as SAP HANA.
An important caveat with High Memory instances is that they are only available on Dedicated Hosts on a 3-year Reservation. This means that you will need to commit to a 3-year purchase, but you will get the security benefit of being on a host that is dedicated, i.e. you’ll have your own server to yourself and will not share resources as AWS does with other offerings.
Type: Accelerated Computing
Accelerated Computing: P3, G3, F1
Accelerated Computing instances use separate Graphical Processing Units (GPUs) or Field Programmable Gate Arrays (FPGAs) to optimize for specialized tasks such as graphics processing or floating-point number calculations. The instance offerings are:
- P3: These are the general GPU offerings, good for machine learning and offering robust parallel processing abilities.
- G3: These are the GPU offerings that are specialized for graphics-intensive tasks such as rendering, encoding, and streaming.
- F1: These are instances that offer FPGAs for accelerated processing. You can leverage the FPGAs multiple ways over time for different enhancements, and all this is aided by custom FPGA-specific AMIs (called AFIs) that offer quicker deployment and development options compared to conventional FPGAs.
Type: Storage Optimized
Storage Optimized: H1 & D2
H1 and D2 instances are part of the Dense storage offerings that provide high sequential read-writes for large data sets, such as in distributed Hadoop deployments. H1 and D2 instances provide immense storage on HDD, with H1 providing a maximum of 16 TB and D2 providing a maximum of 48 TB.
Storage Optimized: I3
I3 instances offer storage on SSD with a maximum of just under 16 GiB. However, these instances provide lower latency than HDD-based storage and also offer AWS Nitro System for optimized access to memory and computer resources (also called “Bare Metal” access).