1

I am trying to use auth0 on AWS EC2 (Ubuntu) using RStudio using the R package - auth0. To make the Shiny app publicly accessible, I have the port 8100 (this is where the app is hosted) open to the public.

Further, I am using the options(shiny.host="xx.xx.xx.xx") to specify the public IP address of the EC2 machine in RStudio. When I run the shiny app through the "Run App" button in RStudio I get this error:

Listening on http://xx.xx.xx.xx:8100
createTcpServer: address not available
Error in .subset2(public_bind_env, "initialize")(...) : 
 Failed to create server

I have similar settings for auth0 as I had on my local machine which works fine.

The auth0.yml file that I use is as under:

name: myApp
shiny_config: xx.xx.xx.xx:8100
auth0_config:
  scope: "openid email profile"
  api_url: !expr paste0('https://', Sys.getenv('AUTH0_USER'), '.auth0.com')
  credentials:
    key: !expr Sys.getenv("AUTH0_KEY")
    secret: !expr Sys.getenv("AUTH0_SECRET")

Any suggestions to debug the issue are highly appreciated.

1 Answers1

0

EC2 instances don’t have their public IP addresses configured on their network interfaces. Hence they can’t listen on them. You’ll have to configure your app to listen on the private IP (check ip addr show eth0) or leave it blank and it should listen on all available local addrs.

The translation from public to the private IP is done by AWS outside of the instance.

Hope that helps :)

MLu
  • 24,849
  • 5
  • 59
  • 86
  • This worked for me, I specified the *private* IP in the `options(shiny.host = ...)` and this can be accessed from outside using the *public* IP. Therefore all the external services like `auth0.com` only need to see the *public* IP which gets auto-translated by AWS to the *private* IP for internal use. – Chintan Pathak Feb 12 '20 at 17:46