[AWS Beginners] Learn Amazon EC2 in 5 minutes!

Hello!
I'm Inoue, a Persian cat from Beyond Co., Ltd.'s Shikoku office.


I would like to provide a quick 5-minute explanation of EC2, one of Amazon Web Services

What is EC2?

EC2 stands for "Elastic Compute Cloud."

It is a service that provides computing capacity, or simply put, it allows you to rent everything you need for a server in the cloud

You can flexibly choose the hardware configuration and OS combination, making construction easy

EC2 is an unmanaged service. AWS manages the servers and network, but you are responsible for managing all installed software, including the OS

What are the benefits of creating a server on EC2?

  • It can be easily created with just one button from the management console
  • Just choose the AMI and instance type
  • No initial costs are required (no costs are incurred until the instance is up and running)
  • There are many instance types available, so you can choose the one that best suits your needs
  • It can be integrated with other AWS services
  • Virtualization technology makes it easy to back up data
  • Because it's cloud-based, you can access it from anywhere
  • You can choose the region and availability zone, allowing you to prepare for failures and disasters

Examples include:

■Main functions of EC2

item Content
Instance A virtual server created in the AWS cloud.
In EC2, you can create multiple servers with the same configuration from an AMI, so the created servers are called instances.
AMI A virtual image (machine image) is
like a mold from which an instance is created.
There are various AMIs available, ranging from simple ones that contain only the OS to types that are fully configured with software.
Key Pair The key to use for authentication when connecting to the instance
EBS Storage available within the AWS cloud,
used as storage for instances.
Security Groups A virtual firewall
that controls traffic for one or more instances.
Elastic IP A static (fixed) IPv4 address.
*An IPv4 address is a number that identifies a communication partner (host).
No two IP addresses can exist on the Internet.

[EC2] Pricing

■Free tier * See the AWS official website

Includes 750 hours of Linux and Windows t2.micro instances (t3.micro where t2.micro is not available) per month for one year. To stay within the free tier, use only EC2 micro instances

■On-Demand:
Charges are incurred by the hour or second depending on the instance you run. Recommended if you want to take advantage of the low cost and flexibility of EC2 without upfront payments or long-term contracts.

It is suitable for applications that cannot be interrupted by spikes or unexpected workloads. If you are using EC2 for development or testing for the first time, you should choose On-Demand

■ Reserved: Compared to on-

Recommended for applications that use periodically or require capacity reservations, provided you can commit to a long-term (1-3 year) usage period and pay upfront for Reserved Instances

If the number of instances running in any given hour exceeds the number of applicable Reserved Instances you own, on-demand pricing applies

■This is an instance with an even larger maximum discount than Spot
Reserved. You can flexibly increase the number of instances during times of high load and decrease the number of instances during times of low load.

The style is to buy the instances you need when you need them, just like at an auction, and then operate them

It can be used for a variety of applications, including stateless, fault-tolerant, or flexible

What is a machine image [AMI]?

AMI stands for "Amazon Machine Image."
It is a template that records software configuration. It is like a mold for creating instances, and its advantage is that once you have the mold, you can create multiple servers with the same settings.

Being able to create multiple servers with the same settings is convenient when you want to have multiple identical servers, and it also makes it easy to create and destroy them

If AMIs were not available, it would be a hassle to have to enter the settings into each server individually, but AMIs eliminate this hassle and allow you to replicate servers with the same settings

An AMI contains the entire contents of a server's disk. When you create an instance from an AMI, everything is copied. Therefore, every AMI always contains an OS

Please note that it is not possible to write only WordPress or only some of the data

What is an instance type?

An instance type is the purpose of a machine

The CPU, memory, storage, network capacity, etc. are combined depending on the purpose. In other words, you choose the performance of the machine for your server

■ Main instance types
EC2 instance type details

Purpose Instance type Content
General-purpose T2, T3, M5, M4, etc General server.
Used when the server has a constant load.
Compute Optimized C5, C4, etc A server with high computing power
Memory optimized X1e, X1, etc A server with improved memory access speed
R4 A server with a large amount of memory
Accelerated Computing P3, P2, G3, F1 Types equipped with GPUs that can be used for machine learning, etc., and types with high graphics capabilities
Storage Optimization H1, l3, D2, etc Storage optimized type

For example, the instance type "T2" has

Seven sizes are available: "nano", "micro", "small", "medium", "xlarge", and "2xlarge". Therefore, you can choose the instance size according to your scale

The instance type is selected based on the general purpose, and
the instance size is selected based on performance such as CPU and installed memory capacity.

Prices vary depending on the instance type and size, and the basic fee is the unit price x usage time

What is EBS?

EBS stands for "Elastic Block Store."

A persistent block storage volume used in conjunction with an EC2 instance. A block storage volume stores data in blocks of bytes, a common way to store data on disk

With EBS, you can choose between HDD and SSD

Regarding the difference between HDDs and SSDs, HDDs support large capacity and are cheaper than SSDs, but their read/write speeds are slower than SSDs and they are also more vulnerable to shocks

SSDs are more expensive than HDDs, but they have the advantage of high IOPS and are resistant to shocks.
*IOPS is the number of input/output operations that can be processed per second.

Therefore, if you are looking for high performance but it will cost more, we recommend SSDs, while if you are not so concerned about high performance and want to keep costs down and operate at low cost, we recommend HDDs

■ Useful features of EBS

Elastic Volumes A function that allows you to easily adjust volume size.
Volume settings can be adjusted according to usage.
Volume changes can be made without downtime or impacting system operations. When disk usage increases, volumes and file systems can be expanded automatically without downtime by configuring the settings in advance.
Volume changes can be easily made on the console. Settings can be changed dynamically by simply specifying the expanded capacity from the AWS console or CLI.
If you need to process 10 times the usual traffic for a certain period of time each month, you can use elastic volumes to set the IOPS higher for that period and then return it to its original value once the traffic processing is complete.
snapshot Function to save all data at the time of saving
Data Lifecycle Manager Ability to create and delete snapshots according to a schedule
Optimized Instances A function that accelerates read and write speeds by designating specific instance types as optimized instances
encryption Ability to encrypt data volumes, boot volumes, and snapshots. Ability to create and manage encryption keys

As mentioned at the beginning, EBS is used in conjunction with EC2 instances

The basic configuration is to store all EC2 data in EBS. Although data can be stored in EC2, the stored data will be lost when the EC2 instance is stopped, so we use EBS, which is a persistent block storage volume that does not lose data even when the EC2 instance is stopped

EBS-optimized instances minimize contention between EBS I/O and traffic from other EC2 instances, providing high performance for EBS volumes

Separate the networks connecting EC2 and EBS, and connect to EC2 via a network path dedicated to EBS

What is a snapshot?

Simply put, a snapshot is a backup

This refers to files and folders that store the entire state of a server's disk at a certain point in time. Since it stores the entire state, it includes not only data and software, but also the OS and configuration information, etc

EBS snapshots are stored in S3, so S3 charges will be incurred for the period the snapshot is kept

*Please read my previous blog post about S3.
[AWS Beginners] A quick guide! What is Amazon S3?

Snapshots are often taken as backups when updating software or the operating system so that they can be quickly restored if something goes wrong, but in AWS they are also used to create custom AMIs

AWS allows you to save EBS volume data as snapshots

However, the first snapshot is saved in its entirety, but subsequent snapshots are saved as incremental backups. This reduces the time required to create a snapshot and reduces the cost of snapshots by not duplicating data

Therefore, when you delete a snapshot, only the data specific to that snapshot is deleted. This is the same for the first data; the difference between the second data is looked at and only the part specific to the first data is deleted

Snapshots are created by selecting a volume from the management console. If you create an EBS volume based on this snapshot, the new volume will be a copy of the original volume

If you want to create an AWI, you create it from a snapshot. By using Data Cycle Manager, you can automate the creation and deletion of snapshots

By taking snapshots regularly, you can mitigate the risk of your server being damaged

If you take regular EBS snapshots, you can create an AMI image to clone a new instance if you want to make a copy of the instance

Finally


I learned about this blog from this book

I wanted to write a blog about EC2, so I'll end it here. I'd like to write about ELB in a sequel to this blog

Thank you for reading to the end

Growing every day, progressing every day.
I have to update myself every day!!!
Thank you for reading to the end.

If you found this article useful, please click [Like]!
14
Loading...
14 votes, average: 1.00 / 114
18,491
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Ayaka Inoue

I'm a member of the System Solutions Department.
I joined Beyond as one of the founding members of the Shikoku office. I jumped into the IT industry with no experience.
As part of the education team, I create curriculum and conduct training for new graduates, mid-career hires, and existing members.
My main job is server operation and maintenance.
Above all, I care about our customers' content.
I'm also a member of the Web Content Division and YouTube team.