I have an EC2 instance running with following details
– t2.micro
– virtualization type = hvm
– Elastic IP assigned = 54-152-108-137
– Public DNS assigned = ec2-54-152-108-137.compute-1.amazonaws.com
– Security group created with following rules/ports enabled
22 tcp 0.0.0.0/0 ✔
80 tcp 0.0.0.0/0 ✔
All All 0.0.0.0/0 ✔
53 udp 0.0.0.0/0 ✔
443 tcp 0.0.0.0/0 ✔
I access the url with public DNS It works fine.
I access the url with public IP. It works fine.
But, I want to access through the domain name which I brought from Amazon route 53.
My domain name is einfachmachen dot ch
Now, I wanted to map this domain to my EC2 running instance
I did the following.
- Created a Hosted Zone. (as the one originally created while buying the domain got deleted or so)
- Choose Domain Name as my registered domain name = einfachmachen.ch
- Type = Private Hosted Zone and chose the VPC id listed in my EC2 console (vpc-24d2a641)
- This got created with 2 default record. One with type NS and another with type SOA
- Updated the NS record set with the NS addresses from my domain (copied the NS addresses from registered domains in AWS Route 53)
- Created a A record for einfachmachen.ch with IPv4 Address and Value = 54.152.108.137
- Created a A record for www.einfachmachen.ch with CNAME and Value = ec2-54-152-108-137.compute-1.amazonaws.com
After this, I checked the url with domain name ..
Nothing works.
I get the error in browser as "This page can’t be displayed".
I checked if it works with static web pages.
I created 2 Buckets in S3
and provided the A record values as the end-points from S3 buckets.
Then it works.
What is wrong in Ec2 and domain linking?
Best Answer
A Private Hosted Zone is used to resolve DNS names within a VPC.
Use a public hosted zone if you want to resolve DNS names on the Internet.
See: Working with Private Hosted Zones