By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Can't able to connect to the EC2 server in private network

0

I have create a vpc and more with 2 AZ , public network and private network, I have place 2 ec2 auto scaling groups in private network and allowed all traffic in security groups. and created bastion host and connected 2 ec2 instance that were created by scaling groups and ran little python server in port 8000 in ec2 servers. and done curl from bastion to internalip:8000 all looking fine. now I have created the target groups and allowed all traffic in security groups and connect from port 8000 and added these in application load balancer. I have pasted dns name of load balancer in browser i'm getting the This site can’t be reached error. Can any one please help on this, thanks in advance :)

  • Check the ALB security group and rules in ALB

1 Answer
2

Based on your description, it seems you're having trouble accessing your EC2 instances through the Application Load Balancer (ALB). Here are some steps to troubleshoot and potentially resolve the issue:

  1. Security Groups: Although you mentioned allowing all traffic in security groups, double-check that the security group associated with your ALB allows inbound traffic on port 80 (HTTP) or 443 (HTTPS) from anywhere (0.0.0.0/0). Also, ensure that the security group for your EC2 instances allows inbound traffic on port 8000 from the ALB's security group.

  2. Network ACLs: Verify that the Network ACLs for your VPC subnets (both public and private) allow the necessary inbound and outbound traffic. For inbound rules, ensure they allow traffic on your application port (8000) and the ephemeral ports (1024-65535).

  3. Target Group Health Checks: Check if your target group's health checks are passing. If they're failing, your ALB won't route traffic to the instances. Ensure the health check path is correct and the instances are responding on that path.

  4. ALB Listener Configuration: Confirm that your ALB listener is correctly configured to forward traffic to the target group on port 8000.

  5. Public Subnet for ALB: Ensure your ALB is placed in the public subnets of your VPC, as it needs to be accessible from the internet.

  6. Internet Gateway: Verify that your VPC has an Internet Gateway attached and that the route tables for your public subnets have a route to the Internet Gateway for destination 0.0.0.0/0.

  7. Application Accessibility: Double-check that your Python application is indeed listening on 0.0.0.0 (all interfaces) and not just 127.0.0.1 (localhost).

  8. DNS Propagation: Sometimes, it can take a few minutes for the ALB's DNS name to propagate. Try accessing it after waiting for a short while.

If after checking these points you're still unable to connect, you may want to review the ALB access logs or CloudWatch metrics for more detailed information about the connection attempts and any potential issues.

Sources
Unable to access the EC2 instance with the Public IP | AWS re:Post
EC2 Connection issue | AWS re:Post
Resolve HTTP connection errors with Application Load Balancer | AWS re:Post

profile picture
answered a month ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions