point only a subdomian to AWS EC2 - amazon-web-services

I own the example.com domain name. For the moment I connect that to two services.
One for firebase as a A name record for the sudomian business.example.com
Another for AWS as A record and a CNAME record.
This is my namecheap Advanced DNS settings
Type
Host
Value
A record
#
AWS IP
CNAME record
api
example.com
A record
business
Firebase IP
For the moment if I visit http://example.com/ it will show me the "Welcome to nginx", So that is clear that since the host is point to # in the A record, the domian is fully connected to the AWS eC-2
What I want is to ONLY CONNECT api.example.com to AWS and connect full domain to vercel. So that I can use example.com and www.example.com in vercel.
How do I do this?

First, make sure that you have created an Elastic IP address in the Amazon EC2 management console. This is a static IP address that will stay with the instance (and can be moved to other instances).
Then, configure your DNS with an A-record that points api to the Elastic IP address:
Type
Host
Value
A record
#
Vercel IP address
A record
api
Elastic IP address (eg 1.2.3.4)
A record
business
Firebase IP

Related

AWS EC2 hosted website map to domain name from godaddy

I purchased domain name from GoDaddy. www.***ta.com
I am using AWS to host virtual machine (EC2 instance).
Now my web site is up and running on EC2 instance. I can access my webpage from public IP address.
I want to use domain that i purchased from GoDaddy www.***ta.com.
I follow online help
Create hosted zone add record set
Type A - with public IP4 in AWS Route 53 and public ip address of EC2 machine.
When i tested it works on AWS but not from the browser.
Anything missing? can you please provide some inputs?
You can either set the DNS records in godaddy DNS zone or Map the DNS servers to Route53 and then create the Zone file.
For setting DNS in Godaddy -
Go to Manage DNS and select your domain.
Add a A record - Enter the IP of your EC2 instance as value and # as key.
Add another CNAME Record - www as key value as #
After sometime your domain will start working.
For setting DNS in Route53 -
Go to Route53 and create a domain by entering your domain name.
In godaddy changethe DNS server 1, server 2, server 3, server 4 to the Name Servers received from Route 53.
after 24 hours your Domain name servers will start pointing to Route53.
Now come back to Route53 and add A record with your ec2 instance IP address.

Point subdomain to EC2 instance?

I bought a domain with Google. I set up custom name servers to point the domain to Zeit.
Custom Name Servers
f.zeit-world.net
d.zeit-world.com
b.zeit-world.org
a.zeit-world.co.uk
Zeit controls the domain. I have spun up an EC2 instance with an elastic IP. I want to be able to point api.mydomain.com to the elastic IP using a CNAME.
added fake elastic ip just for example
now dns add mydomain.com api CNAME 194.119.279.121
I am not sure why it's not being resolved, obviously, I am missing some information. The URL api.mydomain.com just hangs.
Any insight into what step I am missing?

Single domain for multiple ELB

Is it possible for a single domain name to be associated with multiple AWS ELB on different domains?
Eg. I want example.com to point to my first ELB, and api.example.com to point to my second ELB (which is from a different AWS account).
I tried creating an A record for example.com with the first ELB as alias target, and another A record for api.example.com with the second ELB as alias target, but only example.com is working.
For both of the ELB, I use the same domain name for the AWS cert manager to register for SSL cert, not sure if that affects anything.
The problem was that I forgot to allow all incoming traffic on the security group of the ELB...
Yes, you can use multiple load balancers for the same domain or different domains. For the AWS managed SSL certificate, you will need all domain names in the same certificate or you can use a different SSL certificate for each domain name. I would just create one certificate with "example.com" and "*.example.com".
Your issue is that you are using an SSL certificate for api.example.com that has the name example.com. The SSL certificate must include the name that matches the domain name.
If you do not have an SSL certificate installed on the EC2 instance, then setup SSL termination at the load balancer. This means creating a listener for port 443 that forwards to port 80.
To configure Route53 with an ELB in a different account:
For ELB load balancers, do one of the following:
If you used the same account to create your Amazon Route 53 hosted zone and your load balancer – Choose Alias Target and choose a load
balancer from the list. If you have a lot of load balancers, you can
type the first few characters of the DNS name to filter the list.
If you used different accounts to create your Amazon Route 53 hosted zone and your load balancer – Enter the value that you got
in the procedure Getting the DNS Name for an ELB Load Balancer.
If you used one AWS account to create the current hosted zone and a different account to create a load balancer, the load balancer will
not appear in the Alias Targets list.
If you used one account to create the current hosted zone and one or more different accounts to create all of your load balancers,
the Alias Targets list shows No Targets Available under Elastic
Load Balancers.
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 Amazon Route 53 to respond with the
appropriate IP address for your load balancer based on which IP
address format the client requested.
Values for Alias Resource Record Sets

Subdomain pointing to EC2 instance while domain is on S3

I have a root domain like example.com. It's now hosted on Amazon S3. For that I followed this tutorial:
http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
What would I have to do to have a subdomain like client.example.com to point to a EC2 instance?
client.example.com => ec2-XXX.us-west-2.compute.amazonaws.com
Is there like a tutorial out there explaining the steps?
Two simple steps:
You would just need to add a new 'A' record to assign the ec2 ip address to that subdomain in your amazon route 53 dns (or whatever dns provider you are using) - very simple to do. Step one will have requests for that sub-domain routed to the ec2 instance.
Step 2 is to tell the web server you are running, when it receives a requests for that sub-domaain, what website should it serve up to the user - you do this by 'binding' the name to the directory/location thast has the website on your ec2 instance.
You may also want to read over the following from AWS
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-ec2-instance.html
It would also be better practice to assign your EC2 instance an Elastic IP address then forward requests to that IP.
We recommend that you also create an Elastic IP address and associate
it with your Amazon EC2 instance. An Elastic IP address ensures that
the IP address of your Amazon EC2 instance will never change.

How redirect a domain to Amazon EC2 Machine?

I'm using EC2 of Amazon to host a website built in JSP :
http://ec2-50-17-144-64.compute-1.amazonaws.com:8080/p2p
And I bought this domain:
www.p2pbrasil.com
How can I redirect www.p2pbrasil.com to my website in Amazon EC2 ?
When someone type www.p2pbrasil.com it redirects to http://ec2-50-17-144-64.compute-1.amazonaws.com:8080/p2p ?
You need to do two things
In the Amazon Web Service admin panel, create an elastic IP in the same region as your instance and associate that IP with your that instance (IPs cost nothing while they are associated with an instance, but do cost if not).
Add a A record to the DNS record of your domain mapping the domain to the elastic IP address assigned in (1). Your domain provide should either give you some way to set the A record (the IP address), or it will give you a way to edit the nameservers of your domain.
If they do not allow you to set the A record directly, find a DNS management service like ZoneEdit, register your domain as a zone there and ZoneEdit will give you the nameservers to enter in the admin panel of your domain provider. You can then add the A record for the domain in ZoneEdit.
I only mention ZoneEdit because the basic service is free, you could also use Amazon route 53 or a similar pay-for service, if you preferred.
Create an Elastic IP on the AWS Panel, then associate it to your instance.
Then use a DNS management service to add your domain and Ip address (Elastic IP), then on the domain provider panel add the DNS provided from the DNS management service.
I recommend EntryDNS which is actually free.
As you have your server on AWS best option is to use Route53 hosted zone.By doing this you can manage all your DNS entries using AWS. In future if you plan to use ELB's for your application, you can various traffic routing options using Route53.
Create Hosted Zone and get the name servers.
Replace current name servers with AWS nameservers from your Domain registrars DNS entries.
Create an A record in AWS hosted zone and give your servers IP (Elastic IP) as value.
For detailed instruction, you can follow this blog post. Mapping Domain Name to EC2 Server
Assuming this is a hobby website and your domain registrar isn't AWS.
If your registrar (for example godaddy.com) provides a DNS manager you simply need to add a CNAME record for www that points to the aws public DNS record for your instance. For example ec2-50-17-144-64.compute-1.amazonaws.com
This will make http://www.p2pbrasil.com display the same content as http://ec2-50-17-144-64.compute-1.amazonaws.com
Doing it this way you don't have to pay for an elastic IP, which is a dedicated resource. Your IP on your ec2 instance shouldn't change but could if you restart your instance.
Put the public IP from your EC2 instance as an A name to your root domain in Route 53 hosted zone.
This change might take some time.