Redirect a AWS static IP to domain - amazon-web-services

I have deployed a django based website on my AWS lightsail instance. the web address has a port 8000 (:8000). I own a domain on (host =fatcow.com). I have created a hosted zone on AWS and pasted the ns values to my provider(factor)'s Nameservers values. In the amazon route53, I have created a new record with a simple redirect A ipv4 and entered the resolver IP address value - my web address with port value. it doesn't work.
Also, I have read that the redirect will not work for its with port numbers. I have tried redirecting my domain to the static ip, then created another hosted zone record trying to redirect the static ip to the ip+port value - error pops up saying it is not a valid address.
I currently use the development server provided by django as it is a personal website and currently it will not have a lot of traffic - portfolio website.
Also, on my fatcow.com domain settings, the Nameservers are updated and in the whois values, new Nameservers are seen. I have only added the 4 NS values. AWS also created SOA ip values but I was not able to add them to the domain (Inputs were not taken by fatcow ).
In the NSLookup website, I can see NS values and SOA values which are on the AWS hosted zone but A records show none.
Edit: sorry for the confusion. my domain is www.chandradhar.com. I'm not a web dev but I'm trying to deploy a django based portfolio website. I have added Amazon Lightsail DNS nameservers to my domain (host=fatcow.com). the web address is :8000 port. Without the port number, the website isn't loading at all. Only with the port number along the static IP, the website loads. 'A' record isn't taking the port number. I did add a SRV record with the port number(in AWS route 53) but still doesn't work. when checked from the website nslookup.io, the nameservers are updated correctly

Not reproduceable.
> host fatcow.com
fatcow.com has address 65.254.254.33
fatcow.com mail is handled by 10 mail.fatcow.com.
Most probably your changes in DNS have already propagated.

Steps to successfully deploy one or more websites on lightsail AWS when the domain is on another website like godaddy/fatcow.
Create a dns zone in the networking section of the lightsail instance.
Copy the name servers from the dns zone and paste it in the name servers section of the domain provider (fatcow/godaddy) - it might take upto a day for the values to get updated - i used nslookup.io to see if my nameservers were updated.
Create 'A' records and SRV records pointing to the static ip of the lightsail instance.
Install Nginx
Create a simple script with the (name of the website).conf in the conf.d folder/available sites folder
Add the following script:
server
{
listen 80;
server_name domainname.com;
location / { proxy_pass http://ipAdd:PortNum;
}
}
Repeat the same code block with different domains and redirect ports. I guess we can also use 301 redirect to achieve the same.
This might or might not be the proper way of achieving what I required but it'll work.

Related

attach domain name with lightsail instense and django

I have created static ip in lightsail and attached it to the django instanse. I bought domain name from godaddy. I then created domain zone in lightsail and created 2 DNS records type "A" with the following:
#.drmahahabib.com
www.drmahahabib.com
Then i copied the name servers from the same page for my lightsail then took that to godaddy site and changed the name servers there.
Now i get the page that confirms that the lightsail is working but not the site instense of django. do i need to do some modification?
below is the screenshot or just visit the webpage.
my site
If you are using the Django internal dev server use
www.drmahahabib.com:8000
Here 8000 is the port on which you ran the Django server. If you are using another port replace 8000 with your port number
If you want to make your site live on www.drmahahabib.com then you have to configure Apache to serve your application.

Nameserver update for AWS EC2 hosted website

I have deployed a simple html website running on NGINX on a AWS EC2 server. I intend to host 2-3 static websites on this server. For the time being, I have configured only 1 server block and hosted the website.
When I type the ip address/public dns name of the server in the browser, I can see my website. My domain name is registered with another service provider.
How should I update the Nameserver records in my domain registrar account? Should I just update the public ip address in the name server field or should I update the public dns name?
My domain registrar is asking for two name server details as compulsory fields. If I update the same public ip address twice, its not allowing me to save.
Please advise. I want to know the nameserver details for my EC2 based website. My website is not hosted on Amazon Route53.
Do not update your nameserver records, these are records you would use to configure where your DNS records should be resolved.
Instead you need to update/create an A record that points from the domain to your new host IP.

Cannot access AWS domain purchased with Route 53

I recently purchased a domain on AWS mydomain.com with the intention of creating a record set which can forward traffic to an EC2 instance which I also have running. However, when I try to access mydomain.com from a web browser, I get the error that the site cannot be reached.
The record set I created for this domain was myapp.mydomain.com. I configured this to point to my EC2 instance. When I try to access this domain from a web browser, I get a 502 bad gateway error.
Can someone explain what is going on here?
You will need to start by creating a zone in Route53 for the domain - so mydomain.com, NOT anything else.
Once that has been created, there will be 2 records: SOA and NS.
Using the "Registered Domains" screen, click on the domain and make sure that the name server records match the NS records in the zone you created.
Once that is done, you should be able to create a new A record in the mydomain.com zone for myapp.mydomain.com that points to the IP address of your EC2 instance.
The answer given by #chris, which closely follows the official documentation from AWS, is in general the best answer to this question. However, in my case, the 502 error I saw was being caused by that I did not open port 8080 on which my Tomcat server was listening. By adding a custom TCP rule to open port 8080 I was then able to reach my Tomcat.

Assigning domain name to host on Route 53 in AWS

I'm deploying my first app on EC2. I have a domain name registered, lets call it example.com. My ec2 instance has a public ip, lets say, 100.100.100.100. When I got the EC2 instance, I already have a wordpress site installed on it (the blog for my app - blog.example.com). Hitting the public ip directly goes to the blog.
My app is running on the 4000 port of this EC2 instance. I want to assign the example.com domain to this.
I'm using AWS Route 53 for the DNS. I'm clicking on create a record set, where I give the name - www.example.com to the value 100.100.100.100:4000. The type is an IP-v4. However, when I try to assign this, I get the error below:
The record set could not be saved because:
- The Value field contains invalid characters or is in an invalid format.
It's because I've specified the port of the ip in the value. How do I get example.co to point to this app on 100.100.100.100:4000? Thank you for all the help in advance!
Amazon Route53 is a global Domain Name Service (DNS).
DNS services are used to resolve DNS names (eg example.com) to an IP address (eg 100.100.100.100). However, DNS servers do not point to ports on a machine (eg port 4000).
Therefore, to refer to 100.100.100.100:4000, you would use example.com:4000.

Can I use Amazon's DNS servers for my mail server

We have a domain mydomain.com, which we have registered with a UK registrar. We are using Amazon's Route53, and this domain has been added in Route53 and is using the name servers as follows;
ns-558.awsdns-05.net
ns-1755.awsdns-27.co.uk
ns-466.awsdns-58.com
ns-1343.awsdns-39.org
I've added the relevant A records for www etc to point our elastic IP to this domain.
We are also running MailEnable on this EC2 server (running Windows 2012). The MailEnable server is asking for me to enter DNS addresses (Check and configure DNS settings), I assume it will use when sending email.
My question is what DNS addresses / servers can I use ? Can I use
ns-558.awsdns-05.net
ns-1755.awsdns-27.co.uk
ns-466.awsdns-58.com
ns-1343.awsdns-39.org
You can see the DNS address(es) in the screen shot below.
You can't use those Amazon servers because they're authoritative-only (they'll only tell you about domains they know about, instead of acting as a recursive proxy). You can use Google's public DNS servers at 8.8.8.8 and 8.8.4.4 for that field.
(original answer below)
You need to create an A record that points at the elastic IP assigned to your mail server (for example, mail.yoursite.com points at 1.2.3.4). Then, you'd create an MX record for yoursite.com that points at mail.yoursite.com. Finally, I believe you would give MailEnable mail.yoursite.com, but I'm not 100% sure on that.