Some sources suggest that it's https://ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/
(where xxx-xxx-xxx-xxx
is the public IP address of the machine). But when I navigate there Chrome says This site can’t be reached
.
Use the following command to access the public IP address: IMDSv2. [ec2-user ~]$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \ && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/public-ipv4.
You can use EC2 Instance Metadata Query Tool which is a simple bash script that uses curl to query the EC2 instance Metadata from within a running EC2 instance as mentioned in documentation. now run command to get required data.
Just use host
command and specify your public IP - it will show you the right URL, e.g.
$ host 52.204.122.132
132.122.204.52.in-addr.arpa domain name pointer ec2-52-204-122-132.compute-1.amazonaws.com.
where ec2-52-204-122-132.compute-1.amazonaws.com
is your domain.
So you can add https://
in front of it to access the instance via HTTPS.
When you access an URL from any browser, you need to make sure there is a server running on port 80, that is the default port. If you just launched a Linux ec2 instance, it's only accessible through ssh. To access these instances you need de access certificate, generated during the launch process and a ssh client, like ssh for Linux or putty for Windows. Also, if you do have a service running on port 80 or any other, you should make sure these ports are opened in the security policy of your instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With