Redirecting my website to another website in Route53 - amazon-web-services

I want to know how can I redirect my website to another website (through domain name or IP address) using AWS Route53.
What I have done so far is,
1) I have bought a domain name.
2) I have generated AWS Route53 Name servers (NS) for the website and registered these NS on the domain name provider.
Now, suppose my website name is thisnewsite.com and I want that when users put thisnewsite.com or www.thisnewsite.com on browser, they should be redirected to
1)some other website, for example, www.flaticon.com, or
2)some IP address like xxx.xxx.xxx.xxx, or
3)some IP address with port like xxx.xxx.xxx.xxx:xxx
What is the Route53 method to do this?

1) For URL forwarding, see this answer: https://stackoverflow.com/a/14289082/902751
2) For IP redirect, create a record set of type A - IPv4 address that maps your host name to your IP address. This is an example (for EC2, but it will work for any IP): https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-ec2-instance.html
3) For IP redirect with port: Route 53 cannot do that. In fact, DNS in general does not care about port. It only maps domain names to IP addresses. A potential solution would be set up a proxy that would redirect your request from port A to port B.

Related

Redirect a AWS static IP to domain

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.

aws, loadbalancer, what does dualstack mean in dns?

Load Balancer has dns name example-web-3333333.ap-northeast-2.elb.amazonaws.com
and when we assign them in route53, it has dualstack at the front, so that
dualstack.example-web-3333333.ap-northeast-2.elb.amazonaws.com
I'm trying to setup a cdn (cloudflare) for static files, so that when a user hits static.example.com (whose domain is maintained by cloudflare), the dns should be
example-web-3333333.ap-northeast-2.elb.amazonaws.com
Should I include dualstack in this scenario as well?
A dual stack DNS name in AWS means that it will resolve via both IPv4 and IPv4.
If you use the dualstack domain as a value for a CNAME it should enable a client to connect to your domain using IPv6 as well as IPv4.
In either case, the console prepends dualstack. to the DNS name. When a client, such as a web browser, requests the IP address for your domain name (example.com) or subdomain name (www.example.com), the client can request an IPv4 address (an A record), an IPv6 address (a AAAA record), or both IPv4 and IPv6 addresses (in separate requests). The dualstack. designation allows Route 53 to respond with the appropriate IP address for your load balancer based on which IP address format the client requested.
For reference for an Alias record you would need to use an A record for IPv4 and an AAAA record for IPv6.

AWS Application Load Balancer is accessible by IP Address

I have a basic Application load balancer setup that routes web traffic to a few different EC2 instances. The load balancer has two public IP addresses, and both will display my site if entered in the browser. In other words the site can be accessed by the load balancer IPs
How do I configure the load balancer so that the public IP addresses are not accessible in the browser? I would expect the page to fail to load given my load balancer IPs.
All my DNS records point to the load balancer's DNS name and not either of the public IPs
Any help would be great!
When a user enters a DNS name in a web browser, the browser/computer uses DNS to resolve the name into an IP address. Then, the browser connects to that IP address.
DNS is merely a "lookup" service that converts a name to an IP address.
Therefore, it is not possible to disable IP addresses while still allowing DNS to work.
Here's an analogy: Somebody knows your name and want to phone you, so they lookup your phone number in a telephone directory (old fashioned, I know). They then call you on the phone number. It is not possible to allow them to call you without them knowing your phone number.
Add a rule that forwards from your known host name to whichever target group you'd like to forward to.
eg: if host is www.example.com forward to my-site
Then, as your last, default rule have everything else redirect to a custom host, path, query which uses all of the original values of the URL except the host name, which you can specify to your domain name (eg: www.example.com).
So now if someone enters the ip address, he will be redirected to the same page but with the domain name you'd like.
Of course, you can have the default rule do anything you'd like (eg: a fixed response error page).

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.