how to use aws public ips with elixir

Andrew Dixon Source

Have 2 iex shells running on different servers in EC2 but when I try to connect from one to the other I get this error:

Node.connect :[email protected]<--snip-->
** (ArithmeticError) bad argument in arithmetic expression

It looks like elixir doesn't like that the hostname has dashes in it. How can I change the hostname without breaking the routing between the EC2 instances?




answered 6 months ago YongHao Hu #1

The error was caused by atom literal can not contain dash. You can try :a-b-c and :"a-b-c" in iex.

So you should use Node.connect :"[email protected]<--snip-->".

Besides, you can use --name NAME instead of --sname NAME to name a node.

sname option makes and assigns a short name with your hostname.

You can name the node with --name like iex --name "[email protected].

comments powered by Disqus