Madhav mishra
Madhav mishra

Reputation: 404

How to connect ec2 instance to a domain name

I have hosted a python flask app on ec2 instance and is running perfectely. When I run the python file, it hosts on http://132.2303.9:5000/ something like this and I can access it through my web but I want to know that how could I connect it to my godaddy domain name http://abcd.com so that my users can use this abcd.com url to access my services using the same aws ec2 machine. I am new to aws and watched some tutorial about Route53 but couldn't able to figure out . Could anyone help me through this .Thanks

Upvotes: 4

Views: 5933

Answers (2)

John Rotenstein
John Rotenstein

Reputation: 269081

First, make sure you have created an Elastic IP address and have associated it with your Amazon EC2 instance. This is a 'static' address that will not change when the instance is stopped.

Next, access the DNS settings for your Domain Name on GoDaddy.

In those DNS settings, you should add an A-Record that points to the IP address of the EC2 instance. This will make abcd.com resolve to the IP address.

Then, modify the software running on your instance so that it listens on port 80. This will avoid the need to add :5000 to the URL.

For details, see: How do I get Flask to run on port 80? - StackOverflow

Upvotes: 7

Kumar Albert
Kumar Albert

Reputation: 280

First, you need to expose your service in an HTTP(80) port. For that, you can use Nginx as web server. Set Nginx server to listen 80 and set reverse proxying to your service. Nginx will receive requests and forward that to your service.

Once that done, you can configure your ec2 IP and DNS on route53 A record.

Upvotes: 0

Related Questions