2

I am trying to point a fully qualified domain name "example.com" to an external host such as Amazon ELB "site-xxxxxx.us-west-1.elb.amazonaws.com" using HOSTALIASES environment variable and it's not working.

example.com  site-xxxxxx.us-west-1.elb.amazonaws.com

However, when I use a different alias such as "example site-xxxxxx.us-west-1.elb.amazonaws.com". The example correctly resolves.

example site-xxxxxx.us-west-1.elb.amazonaws.com

My Question is can I use a fully qualified domain name "example.com" as an alias pointing to another public domain using HOSTALIASES? If not then what are the other options?

Aftab Naveed
  • 153
  • 1
  • 7

2 Answers2

3

It looks like you can NOT use FQDN hostnames in the first entry:

"If the name consists of a single component, that is, contains no dot, and if the environment variable HOSTALIASES is set to the name of a file, that file is searched for any string matching the input hostname."

Quoted: http://man7.org/linux/man-pages/man7/hostname.7.html

It is not described WHAT the behavior is if you use FQDN as first entry in HOSTALIASES, but there seems to be a restriction and you can only use non domain qualified hostnames

marsh-wiggle
  • 2,145
  • 5
  • 29
  • 45
Fermin
  • 31
  • 3
0

Your best bet is to use AWS PRIVATE hosted zones with a root record and associate them to the VPC. What @Fermin said here is true. FQDNs are not supported by the flow that uses HOSTALIASES only subdomains like localhost and ip-172-27-192-207 are supported. A good example of THAT subdomain mapping is posted here. But like I said, that won't work. You have to use DNS.

https://medium.com/@mitchplanck/aws-lambda-node-js-oracle-3b5806fbecd3

eco
  • 147
  • 9