We setup ethereum node on AWS Ubuntu Server 16.04 LTS (HVM) EC2 instance and configured it in the standard way before launching the geth console using the below command:
sudo geth --identity "EthereumMain" --datadir ~/.ethereum_private/ --networkid "123" --verbosity 3 --nodiscover --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpccorsdomain "*" --rpc --port "30301" --rpcport "8545" --rpcaddr "0.0.0.0" --nat "any" console 2>> ~/fm-ethchain/fm-ethchain.log
(Basically we tried to incorporate all the suggestions we found on various forums and websites to solve the problem!! )
Now, when we try to connect to this node from lambda function using the web3:
var web3 = new Web3( new Web3.providers.HttpProvider('http://xx.xxx.xx.xxx:8545') );
We keep getting the following error:
CONNECTION ERROR: Couldn't connect to node http://xx.xxx.xx.xxx:8545
(where xx.xxx.xx.xxx is the public IP address of the EC2 instance).
Can any AWS Ethereum experts please specify what is it that we are missing?
Best Answer
Maybe it's an issue stemming from AWS. Have you looked into the permissions your Lambda function was given?
You can read more about Lambda permissions here. I'm leaving this as an answer since I'm new to this exchange, but feel free to leave me a comment if you have more info or have tried that.