Can't access AWS EC2 at port 8545 for running app

JBT asked:

I stood up an EC2 t2.micro for the sole purpose of hosting an Ethereum test network on port 8545. Long story short, I SSH’d into the linux machine, installed NVM, the latest version of Node, and the packages necessary for what I needed to accomplish. After running ganache-cli a command line tool for quick creation of Ethereum test networks, I get this feedback from the package

Listening on

I got my public IP from the EC2 instance and attempted to connect at that port. When standing up the test network locally, this works, and gives me an HTTP 400 response, but when trying to connect to the EC2 it simply fails the request with no response. The security group on the EC2 instance allows all http traffic on any port, and the NACL on the subnet it is in also allows all incoming http traffic.

For a sanity check I installed apache on the instance, and hit the public IP again at port 80. I received the Apache welcome message so there’s nothing terminally wrong with the EC2 instance. Is there another step I have to perform in the terminal that I am completely missing that opens up the port?

My answer:

I wouldn’t expect you to be able to reach that port from outside, because – as it explicitly told you – it is only listening on the local host!

Listening on

As shown in the README and in the documentation, you need to use the -h option to specify a hostname if you want to accept external connections. For example:

ganache-cli -h

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.