I'll guide you step-by-step on how to create three instances, install Apache on each instance, start and enable the Apache server, use the echo command inside /var/www/html to mention the servers, create a target group associated with the three instances, configure an application load balancer, create a security group allowing HTTP traffic, and finally, provide instructions :
Create three instances:
- - Launch three instances on your preferred cloud platform (e.g., Amazon EC2, Google Cloud Platform, etc.) using their respective web consoles or APIs.
- - Ensure that each instance is running a compatible operating system (e.g., Ubuntu, CentOS, Amazon Linux, etc.).
Install Apache and start the server:
- - SSH into each instance using a terminal or SSH client.
- - Install Apache by running the appropriate command based on the instance's operating system. For example, on Ubuntu, you can use: Install apache server sudo yum install httpd Start the Apache service: sudo systemctl start httpd Enable Apache on system boot: sudo systemctl enable httpd
Use echo command inside /var/www/html:
- - Open the default Apache index file for editing:
- - sudo nano /var/www/html/index.html
- - Inside the file, use the echo command to display the server's identification. For example:
- - <?php echo "This is Server 1"; ?>
- - Repeat this step for each server, changing the server number accordingly.
Create a target group:
- - Navigate to the load balancing or target group section of your cloud platform.
- - Create a new target group and specify the instances you created earlier to associate them with the target group.
Configure an application load balancer:
- - In the load balancing section, choose to create a new application load balancer.
- - Follow the prompts to configure the load balancer, including selecting the target group you created in the previous step.
- - Create a security group allowing HTTP traffic:
- - In the security group section of your cloud platform, create a new security group or use an existing one.
- - Configure the inbound rules to allow HTTP traffic on port 80. Deny all other inbound traffic unless necessary for your specific requirements.
Attach the target group to the load balancer:
- Associate the target group you created with the newly configured application load balancer.
Retrieve the DNS of the load balancer:
- - Once the load balancer is created and associated with the target group, find the DNS (or endpoint) of the load balancer in the load balancer settings or properties.
- - Test the load balancer:
- - Copy the DNS of the load balancer and paste it into a new browser tab.
- - Upon refreshing the page, you should see the different server identifications (e.g., "This is Server 1", "This is Server 2", etc.) indicating that the load balancer is functioning properly.
Top comments (0)