In this lecture, we will learn about EC2 instances in AWS.
Perhaps one of the most commonly used services from AWS
or any cloud provider for that matter are virtual machines in the cloud.
These virtual machines provide scalable compute
that can be deployed in a matter of minutes.
In AWS, they are called as EC2 instances,
where EC2 stands for elastic compute cloud
and just like any compute, virtual or physical,
an EC2 instance would run an operating system such as a distribution of Linux or windows.
We can then make use of these instances for deploying software such as database,
web servers, application servers
or pretty much anything that you would normally want to deploy in a physical
or virtual machine, which is on premise.
AWS EC2 provides pre-configured templates known as Amazon machine image or AMIs.
These templates contain software configuration such as the operating system
and any additional software to be deployed on these EC2 instances.
Examples are Ubuntu 20.04, RHEL 8, Amazon Linux 2, windows 2019, et cetera.
These AMIs have an ID which is specific to the region where we want to deploy the instance.
EC2 also provides a number of different configurations of CPU,
memory and networking capacity for the instances
which are known as instance types.
There are a wide selection of instance types to choose from
that are optimized to fit different use cases.
One example of the instance type is the general purpose instance type,
and this can be used for several types of common workloads.
Then there are compute optimized instance types
to work on workloads that require high-performance CPUs
such as batch processing workloads and data modeling.
The memory optimized instance types
are designed to deliver fast performance
for workloads that process large data sets in memory.
These are just few of the examples.
For the complete list, please check out the reference documentation.
The most commonly used instance type that suits most of the common workloads
is the general purpose instance.
These are further divided into different categories
such as T2, T3, and M5 instances for example.
Each of these categories can be sized to the specification that a user may need.
For example, the T2 Nano provides one virtual CPU and half a gig of RAM.
The T2 micro provides one vCPU and one gig of RAM.
If you want to go for a higher spec, you can choose from a number of different sizes
such as the small, medium, large, all the way up to 2X large.
The sizes shown here are specific to the T2 general purpose instance type,
and they may not necessarily be the same for all other instances.
For a comprehensive list, please refer to the reference documentation.
Persistent storage for these instances is provided by another service called the EBS,
which stands for elastic block storage.
As of this recording, there are five types of EBS volumes.
Three of these are high-performance solid state type disks,
and the other two are low cost hard disk drives.
The size and type of storage to be attached to an EC2 instance
is available for the user to select before provisioning.
Additional disks may also be attached post provisioning.
The EC2 also allows us to pass in user data to the instances being created.
This allows us to perform common configuration tasks
or even run scripts when the instances start.
For example, if you want to install the NGINX package
on an Ubuntu server when it's launched,
we can pass in a shell script as the user data like this.
For windows instances, we can also pass in a PowerShell
or a batch script with the same effect.
Once deployed, the Linux EC2 instances are usually accessed using SSH keys.
For the windows instances, we can make use of the remote desktop
or RDP along with the username and password.
In the subsequent demo, we will see how to deploy a Linux EC2 instance
using the AWS management console.