> ## Documentation Index
> Fetch the complete documentation index at: https://cloud-architect.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting Connectivity Issues Between VPC, EC2, and Load Balancer

> Hands-on lab · 45m

Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console.

<a className="ip-lab-portal-btn" href="https://labs.intellectualpoint.com/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer" target="_blank" rel="noreferrer">
  Open IP Lab Portal
</a>

## Overview

#### Lab Details:

1. The lab involves creating an VPC, EC2 and Application Load Balancer.
2. Troubleshooting the security group and subnet association to connect IP address and DNS name in the web page.
3. Duration: **1 hour**
4. AWS Region: **US East (N. Virginia) us-east-1**

#### Introduction

1. Virtual Private Cloud (VPC) A logically isolated section of the AWS cloud where you can launch AWS resources in a virtual network that you define.
2. Elastic Compute Cloud (EC2) A web service that provides resizable compute capacity in the cloud, making web-scale cloud computing easier for developers.
3. Load Balancer Distributes incoming application or network traffic across multiple targets, such as EC2 instances, in multiple Availability Zones to increase the availability and fault tolerance of your applications.
4. Misconfigured Security Groups and Network ACLs: Ensuring that security groups and network access control lists (ACLs) are properly configured to allow traffic between the VPC, EC2 instances, and the load balancer.
5. Route Table Misconfigurations Checking if the route tables are correctly set up to direct traffic to the intended subnets and instances.
6. DNS and Load Balancer Configuration Ensuring the DNS settings and load balancer configurations (such as listeners and target groups) are correctly set to route traffic appropriately.

#### Architecture Diagram

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/001.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=4f754b3d865de4d91e72eda7f9d443f9" alt="" width="755" height="509" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/001.png" />

#### Task Details

1. Sign in to AWS Management Console
2. Creating an VPC
3. Creating a Subnets
4. Creating a Route table
5. Creating an Internet gateway
6. Launching an Ec2 Instance
7. Creating an Application Load Balancer
8. Testing the ALB and Ec2 instance
9. Troubleshooting the services.
10. Rebooting the Ec2 instance
11. SSH into your Ec2 instance
12. Installing an Apache server
13. Testing the DNS name and Ec2 Instance Ip address

#### Launching Lab Environment

1. To Launch The Project Environment, Click On The **Start Lab** Button.
2. Please Wait Until The Cloud Environment Is Provisioned. It Will Take Less Than A Minute To Provision.
3. Once The Project Is Started, You Will Be Provided With **IAM User Name, Password, Access Key, And Secret Access Key**.

> **Note :** You can only start one Guided lab at any given time

## Lab guide

#### Lab Steps

#### Task 1: Sign in to AWS Management Console

1. Click On The **Open Console** Button, And You Will Get Redirected To AWS Console In A New Browser Tab.
2. On The AWS Sign-In Page, Leave The Account ID As Default. Never Edit/Remove The 12 Digit Account ID Present In The AWS Console. Otherwise, You Cannot Proceed With The Lab.
3. Now Copy Your **User Name** And **Password** In The Lab Console To The **IAM Username And Password** In AWS Console And Click On The **Sign In** Button.
4. Once Signed In To The AWS Management Console, Make The Default AWS Region As **US East (N. Virginia) Us-East-1**.

#### Task 2: Create a VPC

1. Creating New VPC

2. Make sure you are in the US East (N. Virginia) us-east-1 Region.

3. Navigate to VPC by clicking on Services on the top of AWS Console.

4. Click on VPC (under Networking & Content Delivery section) or you can also search for VPC.

5. Click on Your VPCs from the left menu.

6. Here you can see the list of all VPC, No need to do anything with the existing and default VPCs, we will create a new VPC for this lab.

* Select VPC Only
* Name tag: Enter a VPC name for identification to your VPC. Ex: **MyVPC**
* IPv4 CIDR block: Enter **10.0.0.0/16**
* IPv6 CIDR block: No need to change this, make sure No IPv6 CIDR Block is checked.
* Tenancy: No need to change this, make sure Default is selected.
* Now click on Create VPC button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/002.gif?s=962df45b85c0b43d2c5f08c25b848292" alt="" width="906" height="647" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/002.gif" />

7. Once VPC is created, it will appear with details as shown below:

#### Task 3: Creating Subnets

In this lab, we will create two public subnets in us-east-1a and us-east-1b Availability Zones respectively as follows:

1. For the Public Subnet, click on Subnets from the left menu and click on Create subnet button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/003.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=dfcedaa95ea99b7a32acc71e2f7537e1" alt="" width="290" height="339" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/003.png" />

2. VPC ID: Select **MyVPC** from the list you created earlier.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/004.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=ca621f58d64216623b238e8eabc494bb" alt="" width="1001" height="340" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/004.png" />

3. Subnet Name: Enter Name **MyPublicSubnet1**

4. Availability Zone: Select **us-east-1a**

5. IPv4 CIDR block: Enter the range **10.0.1.0/24**

6. Click on **Create subnet** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/005.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=755d1f3afe48e9b617c4433ece2b8719" alt="" width="1018" height="827" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/005.png" />

7. Repeat the same steps to create another subnet, but the availability Zone: Select **us-east-1b**.

8. Subnet Name: Enter Name **MyPublicSubnet2**

9. IPv4 CIDR block: Enter the range **10.0.2.0/24**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/006.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=922e8ed553e919dbcc490d5463ab52a2" alt="" width="1014" height="820" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/006.png" />

#### Task 4: Create and configure Internet Gateway

1. In this task, we are going to create an internet gateway and configure it with the VPC.

* Click on Internet Gateways from the left menu and click on **Create internet gateway** button.
* Name Tag: Enter **MyInternetGateway**
* Click on **Create internet gateway** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/007.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=25566e94827a167aaffcddd10024ef6a" alt="" width="1027" height="556" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/007.png" />

2. Select the Internet gateway you created from the list

* Click on **Actions**.
* Click on **Attach to VPC**.
* Select MyVPC which you created from the list and click on **Attach internet gateway** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/008.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=955d3e7836bdd82339637d6ca1c073c1" alt="" width="1021" height="358" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/008.png" />

#### Task 5: Create Route Tables

In this task, we are going to create route table and associate them with their respective subnets.

1. Go to Route Tables from the left menu and click on **Create route table** button.

* Name: Enter **PublicRouteTable**
* VPC: Select **MyVPC** from the list.
* Click on **Create route table** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/009.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=f92988aceee0f9bfb986ae81e217caca" alt="" width="1022" height="652" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/009.png" />

2. Now we will associate the subnets to the route tables.

3. PublicRouteTable: Add a route to allow Internet traffic to the VPC.

* Select PublicRouteTable.
* Go to Routes tab, click on Edit routes and on the next page, click on Add route button.
* Specify the following values:
* Destination: Enter **0.0.0.0/0**
* Target: Select **Internet Gateway** from the dropdown menu to select **MyInternetGateway**.
* Click on **Save changes** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/010.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=16f5d2b11b344e59ff7f8018f252f7b5" alt="" width="1832" height="435" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/010.png" />

#### Task 6: Launching an EC2 Instance

In this task, we are going to create an EC2 instance, which will serve as one of the targets for the Application Load Balancer

1. Make sure you are in **US East (N. Virginia) us-east-1** Region.

2. Navigate to EC2 by clicking on the Services menu in the top, then click on EC2 in the Compute section.

3. Click on Instances from the left sidebar and then click on Launch instances button.

* Name : Enter **EC2server**
* For Amazon Machine Image (AMI): In the Quick Start menu, select **Amazon Linux 2023 kernel-6.1 AMI**

  <img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/011.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=2be644ec53f54a63714e1200caba1c57" alt="" width="1184" height="661" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/011.png" />
* For Instance Type: select **t2.micro**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/012.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=55c9201466ca7c8ac04122f96b35809a" alt="" width="970" height="335" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/012.png" />

* For Key pair: Proceed without a **key pair** (Not recommended)

4. In Network Settings, Click on Edit:

* VPC: Select **MyVPC**
* Subet: **Publicsubnet1**
* Auto-assign public IP: **Enable**

5. Create new Security group

* Security group name : Enter **EC2server-SG**
* Description : Enter **Security Group to allow traffic to EC2**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/013.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=e8d34d50f3c4600b64fae951df5dc5a8" alt="" width="971" height="818" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/013.png" />

6. Expand Advanced Details.

7. Under the User data section, copy and paste the below code. This code installs Apache Server and also creates a web page.

```
#!/bin/bash

sudo dnf update -y
sudo dnf install -y httpd
sudo systemctl start httpd
sudo systemctl enable httpd
echo "<html><h1>Response coming from server</h1></html>" | sudo tee /var/www/html/index.html
sudo systemctl restart httpd
```

> Note: After pasting the user data, make sure to remove extra spacing.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/014.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=8d645c9b52e8c9dcbe73e8794607b058" alt="" width="977" height="632" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/014.png" />

8. Keep rest thing Default and Click on **Launch Instance** Button.

9. Select View all Instances to View the Instance you Created

10. Launch Status: Your instances are now launching, Navigate to Instances page from left menu and wait the status of the EC2 Instance changes to running

11. Now in the EC2 dashboard, you can see the instance is running as shown below:

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/015.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=b41e76737d2a35eaf3e40bd3813af6ce" alt="" width="1580" height="205" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/015.png" />

#### Task 7: Creating Application Load Balancer

1. In the left side menu, scroll down to the bottom and select **Load Balancer** under **Load Balancing**.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/016.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=df9de497183d85a16ca7ac878f6d68e7" alt="" width="291" height="179" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/016.png" />

2. Click on the **Create load balancer** button.

3. Select Load Balancer Type: Under the **Application Load Balancer**, click on **Create** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/017.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=bf7d3d05a5064a9ab5218be425242186" alt="" width="340" height="807" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/017.png" />

4. Configure Load Balancer:

* Name : Enter **Myapplication-LB**
* Scheme : Select **internet-facing**
* Ip Address: **IPv4**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/018.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=c7b991178fc1e4bc6cb75c3cab80f07e" alt="" width="1356" height="684" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/018.png" />

* Network Mappings: **MyVPC** and select both subnets 
  Note: If you are getting any error while adding the subnet, ignore it and follow the rest of the steps.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/019.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=3085a1a360137f8da9e5ddc71a6e7294" alt="" width="1351" height="503" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/019.png" />

5. Security groups:

* Select **EC2server-SG security group which we created while launching EC2**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/020.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=faff60e09713329c92987ae7f2e075b0" alt="" width="1292" height="364" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/020.png" />

6. Listeners and routing:

* Load Balancer Protocol : Select **HTTP**
* Load Balancer Port : Choose **80**
* Default action : **Create target group**
* Choose a security group: **default**
* Choose a target type: **Instances**
* Target group name: **Apache-TG**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/021.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=cb87dd75bd6ff6cbe2d8a990630a2994" alt="" width="1002" height="815" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/021.png" />

7. Everything leaves it as default.

8. Click **Next.**

9. Select E**c2Server and select Include as pending below button.**

10. Click Create **target group** button.

11. Ignore the warning message and click **Continue.**

12. Now we can see **Apache-TG target group** created.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/022.gif?s=4c963a5886cb14a8332024bce39c48f7" alt="" width="1000" height="514" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/022.gif" />

13. Now go back to the **Load Balancers** tab, and select **Apache-TG** in Default Action in Listeners and routing.

14. Click on **Refresh** button if target-group is not visible

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/023.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=96b55c3239f0073e94283b64215a5a0b" alt="" width="1329" height="570" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/023.png" />

15. Click on **Create load balancer** button

16. Click on **View Load Balancers.**

17. After 1–2 minutes, the state will change to active and is ready.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/024.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=d566bc27e374a7e2d70cb31d4297f3ed" alt="" width="1445" height="548" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/024.png" />

#### Task 8: Testing Application Load Balancer

1. Copy the DNS name. Enter the address in the browser.

* **Example DNS name:** Myapplication-LB-LB-0a4ff4cc035bae63.elb.us-east-1.amazonaws.com

2. You will see the default apache page. By default, the application load balancer will route the traffic to port 80

3. If the DNS name is not showing in the web page, there is some issue with your configuration.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/025.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=4b92b3f5f8eb9f4b8e7955c2396125b3" alt="" width="1556" height="978" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/025.png" />

#### Task 9: Troubleshooting and Fixing Issues

1. Step 1: Verify Internet Gateway Attachment

* Check Internet Gateway Attachment
* Go to the VPC dashboard.
* In the Internet Gateways section, verify that the Internet Gateway is attached to your VPC.
* If not, attach it.

2. Step 2: Check Route Table Association

* Verify Route Table Association for Public Subnet
* Go to the "Route Tables" section.
* Select your route table (e.g., PublicRouteTable).
* Go to the "Subnet associations" tab.
* If Subnet is not associated, click edit subnet associations, select your both public subnet, and save.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/026.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=e3f78c05db634b50fb5b6001d89fc492" alt="" width="1814" height="574" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/026.png" />

3. Step 3: Verify Security Group Rules

* Check Security Group Rules
* Go to the EC2 dashboard.
* Select your instance and view its security groups.
* Verify that the security group allows inbound SSH (port 22) from your IP and HTTP.
* If not, add a rule to allow SSH and HTTP access.
* Click on edit inbound rules
* Click on add rule select HTTP and click on save rules.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/027.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=163b6a3b6d4fa8156aa84e45d24f8cbb" alt="" width="1828" height="733" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/027.png" />

#### Task 10: Rebooting the Ec2 instance

1. Go to the EC2 dashboard, you can see the instance is running as shown below:

2. Click on your Ec2 instance and click on instance state and reboot your Ec2 Instance.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/028.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=4fce670adfca3cf8d3ea8bd5b5721167" alt="" width="1547" height="195" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/028.png" />

**Task 11: Testing Application Load Balancer and Ec2**

1. Now we are going to test the Application Load balancer DNS name again in web page.

2. Enter the address in the browser.

* Myapplication-LB-0a4ff4cc035bae63.elb.us-east-1.amazonaws.com

3. Now we are going to test the Ec2 instance also.

4. Go to the EC2 dashboard, you can see the instance is running as shown below:

5. copy the public IP address, and paste it into your browser

6. If you are getting this error, please try repeating the troubleshooting steps.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/029.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=4e699170d2c49527ffcc62db55de06c0" alt="" width="1227" height="663" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/029.png" />

#### Task 12: SSH into your EC2 instance

1. Select your EC2 instance(MyEC2Server) and click on the Connect button.

2. Select EC2 Instance Connect option and click on Connect button.(Keep everything else as default)

3. A new tab will open in the browser where you can execute the Linux Commands.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/030.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=16da068e4f313cada4613f23f6d682eb" alt="" width="1075" height="388" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/030.png" />

#### Task 13: Re-Installing the Apache Server on the EC2 instance

> **Note:** The re-installation process helps validate that the Apache server installation and configuration steps have been executed correctly. If there were any issues during the initial setup, this step provides an opportunity to identify and resolve them.

1. Now again, we are going to troubleshoot the Amazon EC2 instance to run an Apache Web Server and verify its functionality by accessing the web server via a web browser using the instance's public IPv4 address.

2. Switch to root user

```
sudo su
```

3. Now run the updates using the following command:

```
yum -y update
```

4. Once completed, lets install and run an apache server

5. Install the Apache web server:

```
yum install httpd -y
```

6. Start the web server:

```
systemctl start httpd
```

7. Now Enable httpd:

```
systemctl enable httpd
```

8. Check the webserver status

```
systemctl status httpd
```

9. You can see Active status is running.

10. To add the contents into index.html file using echo, copy and paste the below command to shell.

```
echo "<html><h1>Response coming from server</h1></html>" > /var/www/html/index.html
```

11. Restart the webserver by using the following command:

```
systemctl restart httpd
```

* **Load balancer DNS name:**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/031.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=27ab167a02e229fec0dc66ccb365e998" alt="" width="878" height="247" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/031.png" />

* **EC2 instance public Ip:**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/FRiGG55B6IHppawE/images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/032.png?fit=max&auto=format&n=FRiGG55B6IHppawE&q=85&s=72310f712da450b4161b188c9479ab93" alt="" width="798" height="325" data-path="images/labs/troubleshooting-connectivity-issues-between-vpc-ec2-and-load-balancer/032.png" />

> ##### Do you know?
>
> Troubleshooting connectivity issues between VPC, EC2, and Load Balancer involves addressing overlooked aspects like misconfigured security groups, subtle route table errors, and conflicting Network ACL rules. These misconfigurations can silently block traffic or cause unexpected issues. Additionally, ensuring proper health check settings on the load balancer is crucial to avoid false negatives.

#### Completion and Conclusion

1. You Have Successfully logged into AWS console.
2. You Have Successfully created VPC and other configuration.
3. You Have Successfully launched the Ec2 instance.
4. You Have Successfully created an Application load balancer.
5. You Have Successfully done the troubleshooting steps

#### End Lab

1. Sign Out Of AWS Account.
2. You Have Successfully Completed The Lab.
3. Once You Have Completed The Steps, Click On **End Lab** From Your IP Lab Portal And Wait Till The Process Gets Completed.

## What gets checked

When you press **Check my work**, the platform verifies each of these:

* **Create Amazon Custom VPC** — Check whether a Custom VPC is created or not.
* **Create Amazon Custom VPC Subnet** — Check whether a Subnet is created for the Custom VPC or not.
* **Create Internet Gateway** — Check whether an Internet Gateway is created and attached to the Custom VPC or not.
* **Create Amazon Custom VPC Public Route Table** — Check whether a Custom VPC Public Route Table is created and an Internet Gateway route is added or not.
* **Launch an EC2 Instance** — Check whether an EC2 Instance is launched or not.
* **Create a Application Load Balancer** — Check if given type of Load Balancer is created or not.
* **Create ELB Target Group** — Check if given type of Load Balancer is created or not.
* **Invoke Load Balancer DNS** — Check whether the Elastic Load Balancer DNS URL is accessible from the internet or not.
* **Install Apache Web Server** — Check whether Apache Web Server is installed in EC2 Instance or not.

## Related help

* [FAQs and Troubleshooting](/aws-saa/support/faqs-and-troubleshooting)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.