Reputation: 34934
I have an ec2 free instance working as well as elastic IP, S3 and RDS. There is a folder with the sources of my application at /home/ubuntu
. I run a built-in server inside this folder:
$ /home/ubuntu/my_app play run
It's running at port 9000
(at my_app
folder). I have A and CNAME records at route53, but they point to the static html pages-stubs at s3, I did it for simplicity and, of course, they shouldn't point to the static pages.
I wonder, how do I make this running Play application visible from outside? I have no idea where in ec2 (or in route53) look for and set it. Obviously, I want it to be accessible as my_custom_domain.com
(which I have) without specifying the port (my_custom_domain.com:9000
).
Upvotes: 0
Views: 657
Reputation: 37419
To change your port from 9000 to 80 - If you work on ubuntu you can use iptables
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 9000
This will route all traffic coming from port 9000 to port 80
To map your elastic IP to my_custom_domain.com from the documentation:
Create a resource record set in your hosted zone. For Type, choose A – Ipv4 address. For Value, specify the Elastic IP address for your Amazon EC2 instance. For more information about creating a resource record set, see Working with Resource Record Sets.
If you want to run several applications on the same server, each on a different port, but serve them each on a different DNS (for example: http://www.my_domain.com
for port 8080, and http://m.my_domain.com
for port 8081), you might want to use ELB
s which can do port forwarding from port 80 to the application port.
With this configuration you can map each ELB as an Alias on a Route 53
Record Set.
Upvotes: 1