Type something to search...
Introduction to AWS EC2: Building Your First Cloud Server

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.micro instances 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!

Related Post

Complete CI/CD pipeline automation starting with GitHub Actions

Complete CI/CD pipeline automation starting with GitHub Actions

Escape the nightmare of manual deployment “Okay, now the coding is done! Let’s connect to the server, get git pull, reinstall dependencies, build, kill the existing process, and launch a new pr

Summary of essential Linux terminal commands for backend developers

Summary of essential Linux terminal commands for backend developers

Throw away the mouse and become familiar with the keyboard If you are used to the fancy GUI (graphical user interface) environment of Windows or Mac OS, when you first connect to a remote server

Cloud Native Architecture Essential Guide: From MSA to Kubernetes

Cloud Native Architecture Essential Guide: From MSA to Kubernetes

Introduction: Why is everyone shouting ‘cloud native’? In the past IT environment, server equipment was purchased directly (On-Premise) and an entire huge application (Monolithic) was installed a

WebAssembly Innovation: Beyond the Browser to Cloud Native

WebAssembly Innovation: Beyond the Browser to Cloud Native

Introduction: WebAssembly breaks through the limits of browser performance The early web was designed simply for sharing documents, and JavaScript was used to add lightweight dynamic effects to t

Zero Trust Architecture (ZTA): A security paradigm shift in the cloud era

Zero Trust Architecture (ZTA): A security paradigm shift in the cloud era

Introduction: Collapsed walls, evolving cyber threats In the past, corporate security strategies were like building a solid wall. Based on the dichotomous mindset that the company's internal netw

Platform Engineering: The Next Evolutionary Step in DevOps

Platform Engineering: The Next Evolutionary Step in DevOps

Introduction: The Paradox of "You build it, you run it" The DevOps culture, epitomized by Amazon CTO Werner Vogels' famous quote "You build it, you run it," has contributed greatly to increasing

The Rise of Edge Computing: Ultra-Low Latency Architecture Overcoming the Limits of Cloud

The Rise of Edge Computing: Ultra-Low Latency Architecture Overcoming the Limits of Cloud

Introduction: Reaching the Limits of Centralized Cloud For the past decade or so, the absolute truth of IT infrastructure was "gather all data into the central cloud." Cloud services operating ma

Mastering Kubernetes: Container Orchestration Beyond Docker

Mastering Kubernetes: Container Orchestration Beyond Docker

What is Kubernetes? While Docker revolutionized the creation and management of single containers, Kubernetes (k8s for short) is a 'Container Orchestration' tool that automates the process of depl

Tips for using Google Drive

Tips for using Google Drive

Here are some useful tips for using Google Drive that will increase your work efficiency. How to use Google DriveWork offline: Set up offline mode so you can edit documents, spreadsheets