What Are Some EC2 Instance Types

Amazon’s EC2 is likely the most popular service offered by Amazon Web Services. EC2 was one of the first services that were offered by AWS when launched in 2006. EC2 service provides users with a secure, configurable, and scalable, computing capacity. Users can spin up any number of instances and any type of instance they want and pay only for the time service is used. Let’s learn a bit more about this great service.

About Amazon EC2

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud.

• EC2 is a key AWS offering
• EC2 means: Elastic Compute Cloud or Infrastructure as a Service
• With EC2 you can easily Rent virtual machines
• Data is stored on EBS (Elastic Block Storage)
• Loads are balanced across multiple instances
• Auto Scaling Groups can be used to scale up and down
• Knowing EC2 is fundamental to understanding how the Cloud works

EC2 Has Many Sizes and 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.

• Choose from Linux, Windows, or Mac operating systems
• Determine random-access memory (RAM)
• Configure the storage space (SSD or HDD)
• Network-attached (EBS & EFS) • hardware (EC2 Instance Store)
• Choose the number of virtual CPUs (vCPUs)
• Firewall rules: security group
• Bootstrap script (configure at first launch): EC2 User Data

EC2 And User Data

When you launch an instance in Amazon EC2, you have the option of passing user data to the instance that can be used to perform common automated configuration tasks and even run scripts after the instance starts. You can pass two types of user data to Amazon EC2: shell scripts and cloud-init directives.

• Bootstrapping is a powerful feature of EC2 where you can configure your instance at the first launch
• That script is only run once at the instance first start
• Automate tasks such as installing software, downloading files, etc.
• You can use the script to install a web server, a database, or any other software
• Downloading common files from the internet
• Anything you can think of
• The EC2 User Data Script runs with the root user

How To Launch An EC2 Instance

To launch a new EC2 instance from an AMI, do the following:

  1. Open the EC2 console.
    Note: Be sure to select the AWS Region that you want to launch the instance in.
  2. From the navigation bar, choose AMIs.
  3. Find the AMI that you want to use to launch a new instance. To begin, open the menu next to the search bar, and then choose one of the following:
    If the AMI that you’re using is one that you created, select Owned by me.
    If the AMI that you’re using is a public AMI, select Public images.
    If the AMI that you’re using is a private image that someone else shared with you, select Private images.
    Note: The search bar automatically provides filtering options as well as automatically matching AMI IDs.
  4. Select the AMI, and then choose Launch.
  5. Choose an instance type, and then choose Next: Configure Instance Details. Optionally select configuration details, such as associating an IAM role with the instance.
  6. Select Next: Add Storage. You can use the default root volume type, or select a new type from the Volume Type drop-down. Select Add New Volume if you want to add additional storage to your instance.
  7. Select Next: Add Tags. You can add custom tags to your instance to help you categorize your resources.
  8. Select Next: Configure Security Group. You can associate a security group with your instance to allow or block traffic to the instance.
  9. Select Review and Launch. Review the instance details.
  10. Select Previous to return to a previous screen to make changes. Select Launch when you are ready to launch the instance.
  11. Select an existing key pair or create a new key pair, select the acknowledge agreement box, and then choose Launch Instances.
  12. Choose View Instances to check the status of your instance.

When you are logged in to AWS you can click on “Launch instances” as shown here in the EC2 menu.

EC2 General Purpose Instance Types

General purpose instances provide a balance of computing, memory and networking resources, and can be used for a variety of diverse workloads. These instances are ideal for applications that use these resources in equal proportions such as web servers and code repositories.

• Good choice for a diverse range of workloads
• Offers a balance between computing, memory, and network resources
• When learning about EC2, t2.micro is a good General Purpose EC2 instance
• t2.micro is a free tier eligible instance

Compute Optimized EC2 Instance Types

Compute-optimized virtual machine (VMs) instances are ideal for customers’ most performance-intensive workloads. Compute-optimized VMs are built on an architecture that utilizes features like non-uniform memory access (NUMA) for optimal reliable uniform performance.

• Great for compute-intensive tasks that require high-performance processors:
• High-performance computing (HPC)
• Media transcoding
• Web Servers that require high performance
• Machine learning and artificial intelligence (AI) applications
• Dedicated gaming servers
• When learning about EC2, c5.large is a good Compute Optimized EC2 instance

Memory Optimized EC2 InstanceTypes

Memory-optimized instances are designed to deliver fast performance for workloads that process large data sets in memory. These instances are well suited for the following: High-performance, relational (MySQL), and NoSQL (MongoDB, Cassandra) databases.

• Fast performance for workloads that process large data sets in memory
• Use cases include:
• NoSql and Sql high load databases
• Web-scale cache stores like Memcached
• In-memory databases focusing on business intelligence (BI) and analytics
• Applications that offer real-time processing of big data
• When learning about EC2, r5.large is a good Memory Optimized EC2 instance

Storage Optimized EC2 InstanceTypes

Storage optimized instances are designed for workloads that require high, sequential read and write access to very large data sets on local storage. They are optimized to deliver tens of thousands of low-latency, random I/O operations per second (IOPS) to applications.

• Storage optimized instances are designed for workloads that require high, sequential read and write access to large
data sets on local storage
• Some Use cases include:
• High-frequency online transaction processing systems such as relational databases
• NoSql databases that require high I/O
• Cache for in-memory databases like Redis and Memcached
• Data warehousing applications such as Apache Hadoop
• i3.large is a good Storage Optimized EC2 instance

EC2 Security Groups

A security group acts as a virtual firewall for your EC2 instances to control incoming and outgoing traffic. Inbound rules control the incoming traffic to your instance, and outbound rules control the outgoing traffic from your instance. When you launch an instance, you can specify one or more security groups.

• Security Groups are the primary means of network security in AWS
• They control how traffic is allowed into or out of our EC2 Instances.
• Security groups only contain rules that allow traffic to flow in or out of the EC2 instance
• Security groups rules can reference by IP or by security group
• Security groups are stateful
• Security groups are attached to EC2 instances


The most common port numbers used with security groups are as follows:
• 22: SSH
• 80: HTTP
• 443: HTTPS
• 3306: MySQL
• 5432: PostgreSQL
• 27017: MongoDB
• 11211: Memcached

What is Instance Connect?

Amazon EC2 Instance Connect is a simple and secure way to connect to your instances using Secure Shell (SSH). With EC2 Instance Connect, you can control SSH access to your instances using AWS Identity and Access Management (IAM) policies as well as audit connection requests with AWS CloudTrail events.

• Connect to your EC2 instance within your browser
• No need to use your key file that was downloaded
• The “magic” is that a temporary key is uploaded onto EC2 by AWS
• Works only out-of-the-box with Amazon Linux 2 and you need to make sure port 22 is still opened!

EC2 Basics Summary

With that we have learned the basics of Amazon EC2(Elastic Cloud Compute), and you made the first step to becoming AWS literate. Having skills in AWS is a great asset to have on your resume, and it will help you to get a job in the cloud
computing industry. Many companies are looking for people with AWS skills, and you can be one of them. We now have a grasp on instance types, and how to launch an instance which is a great first step with AWS and EC2.

Learn More About AWS Instance Types