Amazon EC2 is not only a core service in the AWS ecosystem, but also an essential entry point for anyone who wants to access cloud computing. Faced with the many configuration options in the AWS Management Console, beginners often feel overwhelmed when launching an EC2 instance for the first time. In this article, you will receive detailed step-by-step instructions for creating a properly configured virtual machine, establishing a solid foundation for your journey toward mastering cloud technology.
Deployment model

This illustration shows how an EC2 instance is launched inside an AWS VPC, using a public subnet to allow access from the Internet. Access control is managed through a Security Group, helping secure the server from the initial configuration stage.
Note:
- Select region: us-east-1
- When setting Network: select the default VPC
1. Create security group
First, create Security Groups (SGs) to allow access to the EC2 instance through the sshprotocol, while also allowing access to the EC2 instance through http.
Find EC2 using the search bar in AWS.

In the EC2 console interface -> Select Security Groups -> Select Create security group.

https://linuxunity.com/uploads/imported/saa-ec2-fundamentals-1-e90472fd93.pngEnter the information as shown in the image:
- Security group name:
- Description:
Allow ssh and http from internet - VPC: Select the Default VPC (if your account has multiple VPCs).
- Inbound rules: Here, I only allow access to the EC2 instance via SSH and HTTP, so select these two protocols and allow access from any IP address.
- Outbound rules: As shown below.
- Tags – optional: For this setup, I use the format Name:SG_Name to make it easier to distinguish the security group later.

Finally, receive Create security groupThe SG creation step is complete.https://linuxunity.com/uploads/imported/saa-ec2-fundamentals-4-9387b66ed0.png
2. Create EC2
In the EC2 console > Instance in the left-hand menu, select Launch Instances.

Name: <đặt tên cho EC2>recipient Add additional tags.

OS Images (AMI): default

Instance type: t3.micro (choose an instance type that supports the free tier)
Click “Create new key pair” -> click Create new key pair


Select the key pair you just created.
Network Settings:
-
VPC: select the default VPC
-
Auto-assign public IP:
- Enable: The EC2 instance will automatically be assigned a public IP address, allowing access from outside. This IP address is not static and will be released when you stop or restart the instance.
- Disable: Only a private IP address will be assigned; the instance cannot be accessed directly from the Internet.
Security Groups: select the security group created in the previous step.


Configure storage: ????? default

In Advanced details > User data, copy and paste the following commands:
#!/bin/bash yum update -y yum install -y httpd.x86_64 systemctl start httpd.service systemctl enable httpd.service echo “Hello World from $(hostname -f)” > /var/www/html/index.html
When the Instance is created, these commands will install an additional web server service. Users can then access it via HTTP.

After selecting the option Launch Instance and waiting a few minutes, the initialization process will be complete.

Connect to EC2 via the SSH protocol
First, obtain the command to SSH into EC2. For the newly created EC2 instance, select Connect > SSH Client.

Copy the command as shown in the image below:
- Command 1: Set permissions for the .pem file
- Command 2: SSH into EC2

On a Windows machine, open Command Prompt or Terminal and run the following two commands to copy the above via SSH to EC2.

Successfully connected to EC2 via SSH.
Connect to EC2 via Console
Select EC2 Instance Connect > Connect.

At this point, you are ready to interact with EC2 directly through the AWS interface without needing third-party software. This means you have successfully connected to the instance.

??? Successfully connected to EC2 via the Console.
Access to HTTP
Previously, when setting up EC2, I had already run a script to install the Apache server. Therefore, you can use a browser to access the server via HTTP.
First, you need to obtain the EC2 instance's Public IPv4 address.

Open a browser and navigate to http://IP

??? Successfully accessed the web server via HTTP.
Conclusion
Successfully initializing an EC2 instance not only gives you a virtual server to use, but also provides the first step toward understanding how AWS organizes and operates cloud infrastructure. Once you understand the significance of each choice made during the EC2 creation process, you can make more informed decisions about security, cost, and system scalability. Building on this foundation, you can continue deploying more complex and optimized cloud architectures in the future.