Running two meteor apps in the same aws instance on two different sub-domains using Route53 - amazon-web-services

I have two Meteor Apps deployed in the same AWS EC2 instance. One of them running on port 80 and the other which is the admin app running on port 8000. Both share the same local MongoDB. Now I want to create a sub-domain like dashboard.myapp.com and point it to myapp.com:8000.

Create a dns record pointing to your AWS EC2 instance, install nginx and configure it to redirect all request to dashborad.myapp.com to port 8000 and the other to port 80.

Related

AWS multiple sites, one instance, multiple ports

I have one Wordpress on Apache already deployed on port 80 and configured through Route 53. This is obviously on port 80. Now, I have created a new project in react.js that is listening to different port, port 3000. Both sites are on the same EC2 Ubuntu instance. I would like to attach to the second site (node.js) different domain name and configure this to work, however, I don't know how to do it. Can you please help?
Point the two domains to your EC2 elastic IP(A records).
On apache, configure virtual host which enable you to run two web site on a single machine. see this link: Apache Virtual Host documentation - Apache HTTP Server Version 2.2

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

How to bind Docker Container Running Apache to domain

I deployed application based on this stack on AWS where under Rout 53 DNS is set. I want to point my domain (exampl.com) to web server (any apache/nginx) running in docker container. I want to know how can i bind domain to that web server?
I am not sure it's good or bad way to deploy an application on production but it will help me to understand.
as #mipnw suggested, you can easily run your Docker containers in Amazon ECS.
Since you are not using ECS, here is how you can point the domain to the ec2 instance.
Assign an elastic IP address to the ec2 instance
Reference: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-associate-static-public-ip/
Create an A record in AWS Route53 to point to the elastic IP address.
Reference: https://aws.amazon.com/premiumsupport/knowledge-center/route-53-create-alias-records/
if your docker is exposing for e.g port 80 to the host machine.
Now you can access your application via http://example.com (since http default port is 80), for that you should enable port 80 in your instance's security group
Reference: https://aws.amazon.com/premiumsupport/knowledge-center/connect-http-https-ec2/
If your docker is exposing port for e.g 8080 and you want to access the website via http://example.com, you will need to configure apache/nginx proxy to accept the traffic via port 80 or 443 and forward the request to the port exposed by docker (8080 in this example)
Reference: https://dev.to/kevbradwick/how-to-setup-a-reverse-proxy-to-your-host-machine-using-docker-mii
The most difficult part of your setup is setting up SSL, you would need to configure the SSL certificate inside the nginx proxy.
Hope this helps.
You need to host your docker container somewhere. Since you're already using AWS I'd suggest running your container inside AWS ECS.
Then you'll have expose a port on the container, and configure Route53 to point to your container etc... It looks like ECS Service Discovery makes it easier to register your service running inside ECS with Route53.

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

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.

My AWS ec2 instance is running on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com:8000. how do i make it run on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com

My AWS ec2 instance is running on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com:8000. how do i make it run on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com
I am using Gunicorn server server and it is a Django application on Ubuntu server
You can configure the same via virtual host in httdp.conf with redirection rule or you can do the same with ELB in which you can mention the request comes on 80 and ELB will forward the same on 8000 port.
This is a two step problem:
You have to configure Django to listen on the right port, and you also have to modify the security group attached to your instance to allow connection on port 80.
You can either allow access from anywhere or from a specific IP/Range of IPs.
An other solution is to create an ELB and configure it to listen on port 80 and send the traffic on port 8080.