In previous article, I have mentioned how to upgrade or resize EC2 instance but now in this article, I have mentioned about what is EC2 (Elastic cloud compute) in AWS (Amazon web service) or you can say what is EC2 Instance in AWS.

What is an EC2 instance?

An EC2(Elastic Compute Cloud) instance is simply a virtual server in Amazon Web Services terminology.

With an EC2 instance, AWS subscribers can request and provision a computer server within the AWS cloud.

Using Amazon EC2 eliminates your need to invest in hardware upfront, 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 EC2:

  • Extremely safe to use with a secured login with key pairs.
  • Flexibility in configurations: Users can choose memory size, CPU, and boot partition size optimized for the OS they choose.
  • You can store your instance data in the storage volume provided. These instance store volumes erase the data when the instance stops working.
  • It provides a firewall that allows you to specify ports, protocols, and source IP range that reaches your instance. This is configured using the Security Groups.
  • By default, the instance you create has dynamic IP. You can provide your instance with a static IP using Elastic IP Addresses.
  • Ec2 provides flexible cost-effective plans: hourly or all upfront or partial payment of instance.
  • Auto-scaling: EC2 allows you to get to scale up or scale down according to the website traffic dynamics.

what-is-ec2-instance-aws

What are the AWS EC2 Instance Sizes

There are several EC2 instance size, based on price and configuration of cores and RAM:

1. General-Purpose Instances

Well known for its application in web servers and running deployment for gaming and mobile applications, General Purpose Instances is the most used ec2 instance type. They are explicitly designed for beginners with an easy to use application.

General-purpose instances include – A1, M5, M5a, M4, T3, T3a, and T2.

2. Compute Optimized Instances

These ec2 instance types are ideal for raw compute power systems like scientific modeling, media transcoding, web servers with high-performance, and gaming servers. They are pricier when compared to other instance types, but deploy faster. The expense is based on CPU, Instance storage, memory, EBS bandwidth, and network.

Compute Optimized instances include – C5, C5n, and C4.

3. Memory-Optimized Instances

Memory-Optimized Instances are perfect for memory sensitive applications. They include a high-performance database, real-time massive data analytics, and more.

Memory-optimized instances include – R5, R5a, R4, X1e, X1, and Z1d of high memory.

4. Storage Optimized Instances

If you require high SSD storage, it’s best to opt for Storage Optimized Instances. These ec2 types provide high sequential reading and writing formats for large volume data sets.

Storage optimized instances include – I3, I3en, D2, and H1.

Storage (Volume, Size, Volume type)

Amazon EC2 provides you with flexible, cost-effective, and easy-to-use data storage options for your instances. Each option has a unique combination of performance and durability. These storage options can be used independently or in combination to suit your requirements.

Amazon Elastic Block Store(EBS)

Amazon EBS provides durable, block-level storage volumes that you can attach to a running instance. You can use Amazon EBS as a primary storage device for data that requires frequent and granular updates. For example, Amazon EBS is the recommended storage option when you run a database on an instance.

Amazon EC2 Instance Store

Many instances can access storage from disks that are physically attached to the host computer. This disk storage is referred to as instance store. Instance store provides temporary block-level storage for instances.

Amazon Elastic File System (Amazon EFS)

Amazon EFS provides scalable file storage for use with Amazon EC2. You can create an EFS file system and configure your instances to mount the file system. You can use an EFS file system as a common data source for workloads and applications running on multiple instances.

Amazon Simple Storage Service (Amazon S3)

Amazon S3 provides access to reliable and inexpensive data storage infrastructure. It is designed to make web-scale computing easier by enabling you to store and retrieve any amount of data, at any time, from within Amazon EC2 or anywhere on the web.

How is EC2 Billed?

EC2 pricing is based on the hours and size of an instance, region, and operating system.

AWS Pricing

It is always better to buy All Upfront Reserved instance if you want to use AWS, which reduces cost heavily, rather than going for hourly and per month basis, so I am going to provide All upfront yearly cost for a server only.

Plan All Upfront Cost CPU Memory
t3.micro-Linux $53/year 2 1
t3.small- Linux $107/year 2 2
t3.medium-Linux $213/year 2 4
t3.large-Linux $426/year 2 8
t2.micro -Windows $99/year 1 1
t2.small- Windows $198/year 1 2
t2.medium-Windows $393/year 2 4
t2.large-Windows $715/year 2 8

How to configure a firewall or work with security groups in EC2?

To create a security group, open the Amazon EC2 console:

  • Select a region for the security group
  • Click on "create a security group" and enter a name for the new security group along with a description of the group
  • On the Inbound tab, create rules such as:
    • Allow HTTP(S) traffic to enter the instance
    • Allow SSH traffic to enter the instance

You can also update inbound/outbound rules and add filters based on traffic type in security groups.

You may also like to read:

How to route a domain name to Amazon EC2 web server instance?

Create EC2 instance with step by step guide (Windows Server instance)

AWS vs DigitalOcean (Which is better? with Price Comparison)

Best AWS S3 Free Alternatives

How can I download complete AWS S3 Bucket Locally?