How to link domain name and static ip linking together - amazon-web-services

I am new to all this. I have setup a Nginx server http://52.x.x.x I am testing it. I bought domain name from namecheap. I want domain name routed to the ip. What setting I should configure for this.

First, make sure your instance is associated with an Elastic IP (EIP). If you do not do that, your instance's public IP address will change each time you reboot. Here are the instructions from AWS on how to setup and assign an EIP:
http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/getting-started-assign-eip.html
Note that if you don't associate that EIP to a running instance you will be charged. You can reference EIP pricing here:
https://aws.amazon.com/ec2/pricing/
Next, as mbaird mentioned setup an A record in your DNS management at Namecheap.com. All you have to do is add an A record and enter the public EIP address that you received in the step above. As a start set your TTL (Time to Live) to 60 seconds. Here are the instructions on how to do that from Namecheap:
https://www.namecheap.com/support/knowledgebase/article.aspx/434/78/how-do-i-set-up-host-records-for-a-domain
You can use www.whatsmydns.net to help troubleshoot any DNS propagation. (i.e. It takes a while for all of the world-wide root DNS servers to know that your domain name points to 54.x.x.x)
And finally - just as a suggestion - don't post your IP address in a forum like this unless you absolutely have to. Instead write something like, 54.x.x.x.
I hope this helps!

Related

Managing a subdomain on AWS with R53 and EC2

I followed all the steps given on the tutorial page of AWS to create a subdomain(https://aws.amazon.com/es/premiumsupport/knowledge-center/create-subdomain-route-53/) and I'm pretty sure I got everything right because the tutorial is pretty straight forward. For context, before this I setup a LAMP stack on the server linked with my main domain (example.com).
My question is how to upload and manage files on my subdomain (subdomain.example.com). I thought that all I needed to do was to create a new EC2 instance and link it with the "hosted zone" of my subdomain, and after that I could just upload files and it would work (like I did on my original instance of the main domain). But after many tries clearly I'm doing something wrong, because the page of my subdomain (subdomain.example.com) keeps appearing blank with just the text "This site can't be reached."
You say that you installed a LAMP stack on the instance, so presumably there is a web server listening on port 80.
To test this, first login to the instance via SSH, then try curl localhost to test the web server. If that fails, then there is a problem with your web server.
If it works, the you should check the Security Group associated with the Amazon EC2 instance. It should be allowing incoming traffic on port 80 from 0.0.0.0/0.
Next, obtain the Public IP address of the instance. In a browser on your own computer, try accessing the IP address, eg http://1.2.3.4. That should work if the Security Group has been correctly configured.
By the way, you should be using an Elastic IP address (EIP) for the EC2 instance, which is a 'static' IP address that does not change. You can create an EIP in the EC2 management console, then associate it with the instance. This prevents the Public IP address from changing if the instance is stopped.
Next, try accessing the instance via the domain name. If this does not work, then test the name resolution by using ping with your domain name. The Ping itself won't work, but it should display the IP address that is linked to that domain name. Make sure that the IP address matches the Public IP address you used in the previous step.
If no IP address is provided, then you are missing an A-Record in the hosted zone. You should create the A-Record in the hosted zone and provide it with the Public IP address of the instance.

How to route metabase through a certain domain?

I am relatively new to Metabase. I want to set up an EC2 instance to have my custom website www.*.com display the Metabase homepage so I can follow the corresponding setup. Please can you advise on how this can be done? I have tried and researched but not gotten what I actually want.
Please ask questions if you do not understand any part of the question.
Thanks for the help!
You need to point the domain name to the IP Address of the EC2 machine, using the Domain Name System (DNS), most likely with an "A record"
By default, your EC2 instance, will have a different IP address if you stop/start it, so you should use an Elastic IP Address to give you a static IP
You will need to read your DNS host's documentation to figure out exactly how to do that. If you happen to use AWS's Route 53 DNS service, here is the appropriate link

AWS CPANEL WHM - IP Address and DNS Settings on new accounts

I've (hopefully) successfully set up Cpanel on AWS with clustering following the instructions: https://blog.cpanel.com/part-1-how-i-built-a-cpanel-hosting-environment-on-amazon-aws/
I've been using CPanel/WHM on a dedicated server for a few years before I set up this new Cpanel installation on AWS. My issues comes from how new accounts are set up differently on a dedicated server vs the AWS way.
My first issue:
When I created a new account on my dedicated WHM, I was provided IP Addresses from the server farm that I assigned to newly created accounts. Once assigned, I can access the site with either the IP or the domain name. Now with this new AWS way, there's no info in the tutorials about how I obtain new IP Addresses. I tried adding a new local IP like 10.0.0.30 (because it says it's in NAT mode and use local IP) and assigning this as a dedicated IP to the newly created accounts but I don't understand how anybody can access the site through that IP since its a local IP. So how do I access the domain through custom IP and domain like I did before? I must be missing something fundamental.
My second issue:
On my dedicated WHM after I created a new account, I would typically go to DNS Functions -> Edit DNS Zone and edit the zone to customize my nameserver as so:
mynewdomain.com
ns1.mynewdomain.com
ns2.mynewdomain.com
anothersite.com
ns1.anothersite.com
ns2.anothersite.com
thirdsite.com
ns1.thirdsite.com
ns2.thirdsite.com
and then in my register I would add these custom nameservers into the register and point them to the dedicated IPs of each domain. But with the AWS way, the only way I was able to set this up was to use the new cluster nameservers as the nameserver for ALL accounts in this new WHM installation.
Like this:
mynewdomain.com
ns1.awsnameserver.com
ns2.awsnameserver.com
anothersite.com
ns1.awsnameserver.com
ns2.awsnameserver.com
thirdsite.com
ns1.awsnameserver.com
ns2.awsnameserver.com
Is this the correct / the only way I can set up accounts now through this set up?
Is there a way to have custom nameservers names like I did in dedicated WHM?
In my case, I have a DNS server outside of Amazon so I'm not sure it would answer your question but it might lead you somewhere.
First to figure out what your public IP is you can:
Go to the AWS console and look at the instance detail of your server.
Look for the "endpoint". This points to your public address so you can do a PING or NSLOOKUP to find out what your IP is.
However, AWS does not recommend you hard-coding the public address as it could change. So what I did instead was to create a CNAME in my DNS that points to that "endpoint".
I hope that helps.

website hosted in AWS does not show up

i've registered a .com domain name. At the Amazon Web Services account i own, I have already set up the DNS zone,i've changed the nameservers at my registrar's panel and i've created an A-record in my AWS DNS zone,too. I think i've done all the preparation needed. But my website is not opening!
This is not a DNS propagation time-requiring issue,by the time i did all the above stuff about 5 days ago (DNS had enough time to be refreshed globally in any ISP). Also via ipduh.com i can see that all the nameservers are correctly configured and recognised, as well as the *.mydomain.com A record which points at my AWS instance's IP.
What possibly would be wrong guys? :/ i've done anything i know and i've followed also the directions i've found in SO and i had no luck till now :/
Any suggestion and help would be highly appreciated :D
Thank you in advance guys!
I'm going to assume that the DNS is set up properly, and that the A record is pointing at the IP address assigned to your instance.
If this is a new AWS account, you're probably running in a VPC. Did you make sure that you allocated a public IP address to the instance? If your IP is 10.something, that's the internal, private IP address and you won't be able to use that. You'll need to allocate an Elastic IP and associate it with your instance, then update your DNS settings.
Next, make sure that the web server is up & running? If you log into the instance, what happens if you wget localhost? You might not get the page you're expecting if you're running multiple name-based virtualhosts, but you should get the index page for the default web site.
OK, so how you're sure the web server is running. Next thing to do is check the security rules. When you created your instance, you had give it the name of a security group. The default is, strangely enough, called "defaut". Take a look and see if port 80 is open. If not, open it up to the world (0.0.0.0) and see if you can access the web site now.
None of this helps? Reboot your instance and see if it starts working when it comes back up - it's possible that you're on a bad host, and rebooting will bring it up on different hardware.

How to reference another EC2 instance, which may be restarted or even have another instance started?

Consider an server ec2-50-1-2-3.compute-1.amazonaws.com, which is not publicly available and which does not have an elastic IP address. I cannot assign it an Elastic IP address as I don't have any more addresses to assign (used all 5 already on publicly-available servers).
The publicly-available servers need to access a service on ec2-50-1-2-3.compute-1.amazonaws.com. However, if I restart that server then it may receive a different address and I'll have to update 20 websites across 5 webservers with the new address. Is there any way to refer to the ec2-50-1-2-3.compute-1.amazonaws.com server which will persist even if I restart that server, considering that I have no more Elastic IP addresses to assign to it?
Is there any way to refer to
Key word "refer to" -- indeed, there is... a DNS CNAME.
Whether your DNS is in Route 53 or elsewhere, a CNAME record refers a system asking for a particular host by name, to a different host -- also by name.
Let's say, for example, that the service this system provides is the generation of reports. In the "example.com" domain...
reports IN CNAME ec2-50-1-2-3.compute-1.amazonaws.com.
Any machine looking up "reports.example.com" from the DNS will be referred to the hostname ec2-50-1-2-3.compute-1.amazonaws.com which will of course resolve to the machine's IP address.
If the machine's IP address (and therefore, in AWS, its hostname) changes because the instance was terminated or failed or replaced, you only have to update the information in one place -- the DNS. The systems that need to access this system would be configured with "reports.example.com" instead of the other hostname, so they wouldn't have to be maintained individually.
If you are using Route 53, it's also possible to configure Route 53 to actually give out a different answer using failover routing with health checks and divert requests elsewhere when the instance isn't working properly.
Amazon will not give you any difficulty at all if you simply request more Elastic IPs. It's right here: Request to Increase Elastic IP Address Limit
It turns out the the best way to refer to other instances in AWS is to use Amazon Virtual Private Cloud (VPC). In VPC each machine gets a static internal IP address, which persists for the lifetime of the instance. In fact in VPC one can configure full networking!