[AWS Beginners] Learn Amazon EC2 in 5 minutes!

table of contents
Hello!
I'm Inoue, the Persian cat at Beyond Shikoku office.
of EC2, one of Amazon Web Services
I'd like to give you a quick 5-minute explanation
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 | This refers to a virtual server created on the AWS cloud. With EC2, you can create servers with the same configuration multiple times from an AMI, so the created servers are called instances. |
| AMI | AMIs refer to virtual images (machine images). They are like molds used to create instances. Various AMIs are available, ranging from simple ones containing only the OS to types that have all the software configured. |
| 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. It 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 be the same on the internet. |
[EC2] Pricing
■Free Tier *the official AWS websiteReferenced from
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
■ Charges are incurred hourly or second by second, depending on the instance being run on demand
. This is recommended if you want to take advantage of EC2's low cost and flexibility 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
■ Compared to reserved on-demand
オンデマンドに比べて、料金が割引になリます。使用量が一定または予想可能なアプリケーションでは、オンデマンドと比べて低コストで運用ができます。
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
■These instances offer even greater maximum discounts than Spot
Reserved instances. You can flexibly adjust your usage by increasing instances during peak load periods or decreasing them during off-peak periods.
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's a template that records the configuration of software. It's like a mold for creating instances, and its advantage is that once you have a mold, you can create many 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 | A typical server. Used when the load on the server is constant. |
| 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 factors 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 offer faster IOPS and are more resistant to shocks.
*IOPS refers to the number of inputs and outputs 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 | The ability to easily adjust volume size allows you to adjust volume settings according to usage. Volume changes can be made without downtime or impacting system operation. When disk usage increases, you can automatically expand the volume and file system without downtime by configuring it in advance. Volume changes can be easily made on the console. You can dynamically change settings by simply specifying the expanded capacity from the AWS console or CLI. If you need to handle 10 times the usual traffic for a fixed period each month, you can use elastic volumes to set the IOPS higher for that period and then revert to the original setting 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
*For more information on S3, please see my previous blog post.
[For AWS Beginners] A Simple Explanation! 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, moving forward every day.
I must update myself every single day!!!
Thank you for reading to the end.
14
