0

I have created a good amount of these now but this time around for some reason it does not let me visit the address of the Instance which should have Apache Installed from the user data information inputted of #!/bin/bash yum update -y yum install httpd -y systemctl enable httpd systemctl start httpd ec2-3-249-74-75.eu-west-1.compute.amazonaws.com is my DNS public IP

Have enabled Auto Assigned Public IP address within Instance setup

I have a Security Group with port 80 and 22 open in Inbound and All Traffic for Outbound

I have a VPC with 3 subnets with DNS Hostname enabled and on each subnet Auto-assign public IPv4 address enabled

Even after all of this it displays Public IP address and DNS address but will not connect me, it just keeps loading when inputted. If any more information should be required let me know and I will provide.

HmNoon
  • 21
  • 8
  • 1
    Is your instance in a public subnet? – Marcin Jul 29 '21 at 21:35
  • I manually created them under Subnets with the VPC, how would I check if they're public / private? Thought I would need NAT gateway setup to even create a private one – HmNoon Jul 29 '21 at 21:40
  • Can you SSH to the instance using dns? – Marcin Jul 29 '21 at 21:41
  • No it does not allow me to – HmNoon Jul 29 '21 at 21:42
  • How do I change it to public or even view that it's private? – HmNoon Jul 29 '21 at 21:43
  • Oh wow I see it now under VPC there's another option to create public and private ones... – HmNoon Jul 29 '21 at 21:44
  • So do you have any idea when I create new instances from my AMI I setup, while the user data is what I mentioned in my post with `Installing the Apache server`, these new Instances created from that AMI have a new user data input and that is to display each of their unique 'Instance ID' within the html page ```#!/bin/bash echo "Instance ID: " > /var/www/html/id.html curl --silent http://i-0b3077332eag90f3c/latest/meta-data/instance-id/ >> /var/www/html/id.html``` still does not display the Instance ID of each nor even loads the page now when trying to connect via IP. – HmNoon Jul 29 '21 at 22:31
  • I would recommend making new issue for that, with properly formatted user data, any error messages, what OS are you using, and other relevant info. – Marcin Jul 29 '21 at 22:34

2 Answers2

1

Based on the comments.

The issue was caused by using private subnets for the EC2 instance. For accessing the instance using public IP or DNS, it must be in public subnet.

Marcin
  • 215,873
  • 14
  • 235
  • 294
0

When I launched Public IPv4 address / Public IPv4 DNS it took https by default, i set the protocal to http instead and it worked for me

Pavithra B
  • 141
  • 2
  • 6