How do I link my Route53 domain name to an application running on an EC2 instance on a specific port? - amazon-web-services

I've a django application deployed on an ec2 instance (with public IP a.b.c.d) on port 8080 and have a domain name 'xyz.com' purchased via Route53. How do I link the domain name to my application server?
I've gone through a lot of docs, but it does not seem to be working. I see that while adding a record set, I need to enter the public IP of my ec2 instance in the value field, but how do I get it to route traffic to port 8080 on the box? If I enter a value like a.b.c.d:8080, it errors out saying "The Value field contains invalid characters or is in an invalid format."
Steps I've done so far:
Took an ec2 instance, deployed my web app on port 8080. Everything's
working fine and I can access my app using the public IP (will go
for an elastic IP later)
Registered domain name with Route53.
Created a Hosted Zone with the name of a subdomain.
Created a Record Set with the following info:
Name:
Type: A - IPv4 address
Alias: No
TTL(Seconds): 300
Value: <THIS IS THE MISSING PIECE I GUESS>
Routing Policy: Simple
Can someone point me to any documentation for this? It seems to be a straightforward thing, but somehow I cannot find how to link the pieces.

You shouldn't enter your port, just your IP. Your application will then be accessible at: xyz.com:8080
To make it accessible at xyz.com you need to configure a web server (like nginx, apache...) or a proxy that will redirect the requests coming on port 80 to port 8080.
Django on Nginx with uWSGI: http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
You can also make your django app run directly on port 80 but apparently it's a bad idea: Run Django without Apache using runserver on port 80 and accessible outside LAN

Just want to point out that SRV records do support port definitions in DNS, but we should not expect browsers (or many clients for that matter) to query for SRV records.

Related

How do i set a public URL when using EC2

I have an instance setup for a test site using Amazon Web Services listed under EC2.
I then setup an Elastic IP which as i understand is a static IP.
Once logged into this instance of Windows Server i setup a site in IIS which runs locally.
I have set all the bindings in IIS but struggling to figure out how i assign a public name to this instance so i can view the site in an external browser? I tried entering the IP but that doesnt open anything, not even the standard IIS page?
Check your firewall if you have opened the port 80 or whatever the IIS is bonded with
and also check your security group of the EC2 instance and open the port 80 to the world

What is the endpoint of the EC2 linux1 instance?

I created an EC2 linux1 instance and I SSH into it. I installed NodeJS and cloned a git repository to the instance. The app is successfully running and connected to the MySQL database instance I created from the RDS. Assume the app name is my-app. What I want is to be able to access the the app on the server.
I tried
- ec2-{Public DNS (IPv4)}.compute-1.amazonaws.com/my-app/{endpoint} (not working)
- {Public DNS (IPv4)}/my-app/{endpoint} (not working) (not working)
The security group of the instance is set like below:
Any help is appreciated
If your app is running on port 4000, you need to either open that port in your security group, or add a firewall/reverse proxy to forward from 80/443 to 4000.
You can use iptables to forward the port:
Forwarding traffic from 80 to 8080
or apache as a reverse proxy:
Apache redirect to another port

VM Instance group to configure to listen on port 80 and 8080

I have configure my VM in such a way that I have 2 application running on one VM.
First App listen on ip:80 port
Second App listen on ip:8080 port
I have enabled ports on VM instances group like this.
I have my Load Balancer configured with two front rules like this.
I want to map ip1:80 to my 80 port application and ip2:8080 to 8080 application
when I tried accessing my application using load balancers IP address it always show me 8080 port application.
I have two backend service running
help me here google team. I m newb
If you want to use IP addresses but not URLs/Domain(s) to reach to your web applications, then URL Maps cannot help to implement your design, as URL map forwards the request to the correct backend service using host values (example.com) and path values (/path) in the destination URL.
That being said, you can add one more Target Proxy to your LB resources to route incoming requests directly to the desired backend services. This will allow you to keep your minimum number of instances as one VM.
For more information, visit this article.
I had similar problem and I had to add second backend.
So I have two backends: one for 80 port, other for 8080. And I have on managed group.

AWS Public DNS does not load even though SSH works

I have set up an AWS EC2 Instance with LAMP stack and installed Wordpress.
My instance was accessible through a browser via its public DNS. I logged into wordpress admin and made some changes and everything was working ok.
I then added an Elastic IP and I now cannot access my site through a browser via its public DNS.
However, the server is fully accessible via SSH.
The public DNS is:
[ec2-52-210-2-56.eu-west-1.compute.amazonaws.com][1]
My security groups are as follows:
80 tcp 0.0.0.0/0
22 tcp 209.93.74.222/32
443 tcp 0.0.0.0/0
I have removed the EIP. That made no difference. I have rebooted and stopped and restarted the instance. That made no difference either.
I am not sure how to fix it?
I had similar problem when i was new to AWS figuring out new things.
What i found out was you need to perform the below steps to redirect your url to correct IP address:
The old site URL and the new site URL for your instance. The old site URL is likely the public DNS name for your EC2 instance when you installed WordPress. The new site URL is the current public DNS name for your EC2 instance. If you are not sure of your old site URL, you can use curl to find it with the following command.
$curl localhost | grep wp-content
You should see references to your old public DNS name in the output, which will look like this (old site URL in red):
<script type='text/javascript' src='http://ec2-52-8-139-223.us-west-1.compute.amazonaws.com/wp-content/themes/twentyfifteen/js/functions.js?ver=20150330'></script>
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Search and replace the old site URL in your WordPress installation with the following command. Substitute the old and new site URLs for your EC2 instance and the path to your WordPress installation (usually /var/www/html or /var/www/html/blog).
$ php wp-cli.phar search-replace 'old_site_url' 'new_site_url' --path=/path/to/wordpress/installation --skip-columns=guid
Your website will be fixed!!!
Done!
NOTE: But everytime you change the IP you need to change your url to new IP.
Visit This site can’t be reached Amazon Ec2
I got the issue with Windows EC2 while connecting through HTTP 80 port and followed below link.
If your computer is on a corporate network, ask your network administrator whether the internal firewall allows inbound and outbound traffic from your computer on port 22 (for Linux instances) or port 3389 (for Windows instances).
If you have a firewall on your computer, verify that it allows inbound and outbound traffic from your computer on port 22 (for Linux instances) or port 3389 (for Windows instances).
or follow link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html#TroubleshootingInstancesConnectionTimeout
Check Firewall settings in your Windows EC2: Goto > Firewall Settings or Properties choose public profile > check inbound connections, change to "Allow" if it is "Blocked by default"

amazon ec2 elastic ip redirecting not wroking

I've registered domain with bigrock.in
Created ec2 instance in aws
created elastic ip
registered with route53 and gave my domain name
changed the name servers in bigrock with the provided names in bigrock
ssh to the ec2 instance with elastic ip
ran node.js app with forever
with the following environemnt variables
export ROOT_URL="www.domain.com"
at the time of route53 process, I created A record with www sub-domain to elasticIp
But, I'm not seeing anything at domain.com or at elasticIp xxx.xxx.xxx.xxx
Did I miss any steps, Is there anything wrong I did or do I need to do anything to make this works
EDIT
I haven't added any A or CNAME records to bigrock just changed the name server to the servers provided by ROuter53
Edit 2
that is my security group outbound details, My app is running on port 80.
Are those settings correct?
EDIT 3
My INbound rules
You've got a rule to allow all traffic from anywhere on the INBOUND security groups so its not that (make sure you fix this later when you get it working - as it is, its a bit of a security hole).
Next thing I would normally say is its a dns problem, but as you say you've tried going to the eip as well as the domain name its not that either.
Next likely candidates are:
The server isnt listening - it may be that it hasnt started properly try checking the logs,The machine's firewall is blocking connections. (try turning it off - keep this at VERY short time length though - its a huge risk in combination with your security group settings)
Or your server is not listening on port 80, e.g. it might be listening on 8080 or 443. Check the server config - by default browsers assume port 80 for http, if its not listening on that you will have to specify the port in the address bar as well e.g. http://example.com:8080