-1

I have an api running in a EC2 instance in AWS in certain port (ej 8000). I have register a domain in bluehost provider.

Currently my app is pointing to the IP that offer the EC2 instance, but I want to change to the domain in order to use like api.mydomain.com:8000.

I tried to create a configuration in the DNS zone of panel control in the bluehost account, but it does not work, I think the DNS type I have to use is the 'SRV record', but I tried some configuration but the cpanel dont take it.

How I can make that the request to 'api.mydomain.com:8000' redirect to the EC2 instance's IP and the configurated port?. Thank you

2 Answers2

1

Normally you would create an 'A'record to point a domain name to a IP address, not a 'SRV' record.

E.J. Brennan
  • 45,870
  • 7
  • 88
  • 116
  • I tried yet to create a 'A' record, but it doesn't work, when i make the request, apparently the port is missing; for that reason I investigate and saw the 'SRV' record. Thank you. – Juan Carlos Villalobos Apr 26 '19 at 14:27
  • DNS (except the SRV record, which isn't used by HTTP) doesn't know about port numbers. – Alnitak Apr 26 '19 at 15:13
1

You can use a normal A record for api.mydomain.com and point that to your instances IP address. You don't include the port anywhere in the DNS configuration.

If it was a website that was on port 8000 you would type api.mydomain.com:8000 in your browser url.

Make sure that your instances security group is open on port 8000, and that your instance is listening on port 8000.

When you say "it didn't work", what do you mean? Where was there a failure?

WarrenG
  • 1,750
  • 12
  • 20
  • It's solved now, thank you to EJ Brennan, WarrengG and Alnitak, you were rigth. I tried again to create the 'A' record, doesn't work, but what you said make think and remember one configuration file (I a'm not expert in configuration), I added then api.mydomain.com and it worked. Thank you very much, i have been many days working on that, sorry for an elemental question. – Juan Carlos Villalobos Apr 26 '19 at 20:07