
Introduction to AWS EC2: Building Your First Cloud Server
I need my own server!
The joy I felt when I studied programming and created my first web application is indescribable. However, if it only works on my computer's local host (localhost:3000), it will only be half complete. To provide access to anyone in the world, you need a computer that is always on and connected to the Internet - a Server.
In the past, you had to go through the complicated process of purchasing your own server computer and connecting network cables, but now, thanks to cloud computing, you can rent a powerful virtual server in just 5 minutes with just a few clicks. Among them, we will learn about EC2 (Elastic Compute Cloud), the most core and basic service of Amazon Web Services (AWS), the world's No. 1 cloud service, and look at the process of creating an instance yourself.
What is EC2 (Elastic Compute Cloud)?
EC2 is a virtual server hosting service of flexible size provided by AWS. Simply put, it is "borrowing the resources (CPU, RAM, disk) of high-performance computers in Amazon's huge data center as much as I want".
Key features of EC2
- Elasticity: You can optimize costs by increasing server performance or increasing the number of servers (Scale-up/out) when traffic is high, and scaling them back down (Scale-down/in) when traffic decreases.
- Various operating systems: You can select and install the operating system (AMI) of your choice, including Linux (Ubuntu, Amazon Linux, etc.) and Windows Server.
- Billing per second: We adopt a pay-as-you-go method where you pay only for the time the server is turned on, so there is no initial infrastructure construction cost at all.
- Free Tier: New subscribers can use
t2.microinstances for 750 hours per month (effectively an entire month) for free for one year. Perfect for learning!
Summary of EC2 instance creation process
Although the AWS console screens change frequently and may seem complex, the core setup steps are always:
1. Select region
Select the physical location where your AWS data center is located. If Korean users are your main target, be sure to select 'Asia Pacific (Seoul) - ap-northeast-2' in the upper right corner to minimize network latency.
2. Select AMI (Amazon Machine Image)
Just as you choose between Android and iOS when buying a smartphone, this is the step to choose the server operating system. For beginners, we recommend the latest LTS version of Ubuntu Server as it has the most community support and is easiest to use. Be sure to check if there is a ‘Free Tier Available’ mark.
3. Select Instance Type
Determine the server's hardware specifications (number of CPU cores, memory capacity). Select t2.micro for which the free tier applies. (There are regions where t3.micro is free tier, so be sure to check the mark.)
4. Generate and download key pair
This step is most important for security reasons! Create a master key (used instead of a password) to remotely connect (SSH) to the EC2 server. Select RSA method and download in .pem format.
Caution: This key file can only be downloaded once, so it must be kept in a safe place to prevent it from being lost or leaked. Be extremely careful not to accidentally upload to GitHub.
5. Network and Security Group Settings
A security group is a virtual firewall surrounding a server. Decide which ports to allow incoming traffic.
- SSH (port 22): must be open for me to access and manage remotely. If possible, it is safe to set the source type to 'My IP' to block access only to you.
- HTTP (port 80) / HTTPS (port 443): To run a web server and allow general users to access, these ports must be opened as 'Anywhere'.
6. Storage (EBS) configuration
Set the server’s hard disk (SSD) capacity. Free Tier allows you to use up to 30GB for free, so it is recommended to increase it to 30GB instead of the default (8GB).
Connect to EC2 instance using terminal (Mac/Linux)
Once the instance creation is complete and the status is 'Running', make a note of the assigned 'Public IPv4 Address'. Now let’s open a terminal and connect using the downloaded key pair (.pem).
# 1. Change the permissions of the key pair file so that only you can read it. (Very important!)
chmod 400 my-key-pair.pem
# 2. Connect to the server using the SSH command. (The default username for Ubuntu AMI is ubuntu.)
ssh -i /path/my-key-pair.pem ubuntu@public_IP_address
When you first connect, when prompted to continue fingerprinting, enter yes. If your terminal prompt changes to ubuntu@ip-172-xx-xx-xx:~$, congratulations! I have finally successfully connected to my own cloud server.
finish
Now you can install Node.js on top of this empty Ubuntu server, import your code into Git, and launch the server. Although EC2 is the most basic service, it is the first step to understanding cloud infrastructure. Don't forget to 'stop' or 'terminate (delete)' your instance when not in use to avoid a huge bill!





