INTRODUCTION
Launching an EC2 instance on AWS is similar to creating a cloud-based virtual machine. However, it needs storage, which is where volumes come in, just like any other computer. In AWS, a volume is essentially a virtual hard drive (also known as an EBS volume) that houses the data, programs, and files on your server. Your instance wouldn't have a location to save modifications or install applications without it. You will discover the functions of volumes, their management, and their importance in the operation of cloud servers in this guide.
Before you begin, ensure your AWS account is operational. If you haven’t set one up yet, no worries, I’ve broken it down step-by-step in a previous guide. You’ll also need Git Bash for this setup, so be sure to download it if you haven’t already.
Let's begin!
- Log in to your AWS account and create an instance, but for this, we will launch two instances.
-
Name the instances (web1 and web2):
- Select Amazon Linux 2:
- Use t2 micro and select the already created key pair from the last article:
- Allow HTTP: with this setup, you’ll be able to view and test your work directly in the browser.
Make sure both instances are in the same region and availability zones.
Don't forget to copy the IP address
Open GiT BASH
- Connect to the key pair: cd downloads
- Connect to the instance: ssh -i your-key.pem ec2-user@ip address:
- Update the system and install: to update (sudo yum update -y), and to install(sudo yum install httpd -y)
(Operational) Customize each server’s homepage so you can tell them apart: echo "This is Web Server 1" | sudo tee /var/www/html/index.html
Now we go back to the EC2 dashboard
- Create a Target Group:
-
Name the target group:
Leave every other thing in default and click next to add both instances.
-
Register both instances: make sure you tick both boxes, and then create.
Go back to the dashboard so we can create the load balancer
- Create a load balancer:
- Select the Application Load Balancer:
-
Name it:
- Select the availability Zone of your instance:
- Select the target group that you created earlier:
Go back to the dashboard and copy your DNS and paste it in your web browser, and that's it
At first, getting your AWS load balancer to function can be a little challenging, but after Apache configuration, security groups, and health checks all work together, it becomes easy. Don't worry if yours didn't load immediately. The most important thing is to ensure that your load balancer is correctly linked, your firewall rules are open, and your EC2 instances are in good health. You're ready for scalable, seamless web traffic once things are in place.
Until next time, stay curious.
Top comments (0)