Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206180

Can't access R plumber API on EC2 from local machine

$
0
0

Tried to build proof-of-concept for plumber API running on AWS EC2 instance.

I successfully (I hope I did!) followed this post (Deploying a Plumber API on AWS EC2 Instance) up to step 7, with the exception of replacing R CMD BATCH with Rscript: namely, Rscript launch-sample-plumber.R.

Now the API works perfectly on R Studio Server on my EC2 but not from my local machine. I also referred this post (Hosting a Plumber API on AWS), which described the same problem. Followed the instruction (setting host to 0.0.0.0) so now I can see this when I run ubuntu@ip-172-31-59-224:~$ netstat -an | grep 8000:

tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN

... which suggests that it should work from my local machine, but it still doesn't. Following commend in R Studio on EC2 works perfectly but it spits out this error message on the local machine.

> POST("http://ec2-172-31-59-224.ap-southeast-2.compute.amazonaws.com:8000/sum?b=1&a=3")
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Timeout was reached: [ec2-172-31-59-224.ap-southeast-2.compute.amazonaws.com:8000] Connection timed out after 10000 milliseconds

I've set the security rule to allow all inbound traffic from HTTP port range 80.

Of course the actual DNS address was used.

What did I do wrong? Any help would be much appreciated!


Viewing all articles
Browse latest Browse all 206180

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>