Codementor Events

What Is an Instance? Understanding AWS EC2

Published Nov 18, 2019
What Is an Instance? Understanding AWS EC2

In Q3 of 2019, Amazon reported $9 billion in revenue from Amazon Web Services (AWS) alone. A large part of that amount comes from Elastic Cloud Compute (EC2) services. EC2 is one of AWS’s core cloud offerings. Airbnb, Netflix, and reddit are just a few of the companies that use this product and more are joining every day. These companies are so massively successful, at least in part, due to how they are using cloud services.

Cloud computing is drastically changing the ways businesses operate. To keep a competitive edge, it’s important to know what your options are and how the technology works. In this article, you’ll learn what EC2 is and how it operates using instances.

What Is EC2?

Amazon Elastic Cloud Compute (EC2) is the primary compute service available through AWS. It is a service that enables you to use computing power, storage space, and network connectivity in the cloud. You can use EC2 to provide web-based services to clients or to host workloads for a private network, like your organization.

EC2 operates via instances that you create and provision to host your applications, workloads, and databases. It is available across 22 regions and 69 Availability Zones (AZ). EC2 works via a pay-for-use system with per-second billing.

Billing is based on instances being active regardless of whether they are performing any computing processes. Inbound data transfers are free. Outbound transfers cost an additional amount, according to the transfer destination and amount of bandwidth you use.

Some benefits of EC2 are:

  • Auto-scaling — you can configure AWS to add or drop instances according to traffic demands. You can configure scaling according to a schedule or rule-based policy.
  • Decreased costs — you don’t have to pay for maintenance, physical infrastructure, or hardware costs. Your cost is based only on what you provision and use, reducing capital expense costs.
  • Reliability — you can use EC2 across multiple regions and AZs to ensure fault tolerance. Since your instances are run on independent infrastructures, you eliminate single points of failure.

What Is an Instance?

An EC2 instance is roughly the same as a Virtual Machine (VM). EC2 instances, like VMS, are virtualized machines with self-contained operating systems hosted on virtualized hardware. You create instances from Amazon Machine Images (AMIs).

AMIs include configuration settings and an operating system image. There is a variety of premade AMIs available from AWS as well as third-party AMIs available from the AWS Marketplace. You can also create custom AMIs.

There are 20 different instance types you can choose from. These instance types fall into five main categories:

  • General Purpose — provide balanced performance between compute, memory, and traffic. You typically use this type for web servers, containerized microservices, data stores, or DevOps environments.
  • Memory-Optimized — provide fast processing of large data sets. You typically use this type for high-performance databases and real-time data processing.
  • Storage-Optimized — provide fast read/write access to large data sets. You typically use this type for NoSQL databases, data warehousing, and distributed file systems.
  • Accelerated Computing — provides hardware acceleration via co-processors. You typically use this type for machine learning, media streaming, and gaming servers.
  • Compute-Optimized — provide high-performance processing. You typically use this type for batch processing, high-performance computing, data analysis, and gaming servers.

When creating instances, you can create them according to three different types. These types differ in price and availability.

  • On-demand — you create instances and use resources as needed. Use is not contract-based and you make no up-front payments. On-demand instances are useful for workloads with inconsistent or unpredictable resource demands. For example, environments for testing or developing applications on AWS.
  • Reserved — you provision resources with a contract of 1 to 3 years and receive a discounted hourly rate. Reserved instances are useful for applications with predictable traffic demands, mission-critical workloads, or when you can plan long-term application use.
  • Spot — you use resources that are left in excess of current AWS customer demands in exchange for a significant discount. Spot instances run when resources are available according to a bid price you define. No SLA is included with spot instances. Spot instances are useful for applications that aren’t time-sensitive or when applications would be too costly to run otherwise.

How are Instances Different Than VMs?

One main difference between EC2 instances and VMs is that instances are ephemeral. When you stop an instance, or an instance fails, you cannot just restart it from its previous state like a VM.

When an instance is stopped, the server resources tied to it are released for use by other tenants. So are its IP addresses, unless you are using the instance in a Virtual Private Cloud. Its storage may also be erased depending on the type of storage you’re using.

You have three storage options for EC2 instances.

Instance Store
Instance stores are temporary storage tied to the operation of the instance. If your instance is stopped for any reason, this storage is wiped. Instance stores are included in the cost of your instances. The max instance store size is 10GB.

Elastic Block Service (EBS) Volumes
EBS is a paid storage service that you can tie to your instances. EBS volumes work like an attached hard drive. This storage is persistent if your instance is stopped. You can attach multiple volumes to a single instance. You can also create snapshots of your volumes for backup or to share data with other instances. The max volume size is 16GB.

Simple Storage Service (S3)
S3 is a paid storage service with storage buckets that you can tie to your instances. You can access S3 buckets from instances or directly from an Internet connection. You can access a single S3 bucket with multiple EC2 instances. The max S3 bucket size is 5TB.

Another difference between an instance and a VM is that instances take up a persistent amount of space on a server. VMs only take up compute, storage, or memory resources when needed. If not needed, these resources are available to your host or other VMs you are running.

In the cloud, your instances are run on a server that is shared with other tenants. To prevent these tenants from having access to your instances’ resources, space is reserved specifically for your instances. If you have multiple instances, you cannot share resources as you can with VMs. You can still share workloads between instances, depending on applications.

Conclusion

EC2 can be a game-changer for businesses of any size. It enables you to run applications and workloads in the cloud faster, and potentially cheaper, than you can manage on your own. This doesn’t mean that it’s the perfect solution for every business or every workload. Whether it is the solution for you depends on your budget and your computing needs.

Hopefully, this article helped you better understand what EC2 is and how it works. Understanding its limitations and being prepared for how costs are distributed is vital. This information can help you ensure that any transition to EC2 is as effective for cost and productivity as possible.

Discover and read more posts from Eddie Segal
get started