0

I made an environment on Cloud9 on AWS, then made a folder named "ruby_projects", then inside that folder, I ran the command:

rails new todolist

then from inside the todolist folder, I ran

rails s

In the share button on the top right corner of the environment, I opened the application link which is 35.162.65.187, but instead of saying "you are on rails" it says:

Oops
Error: 1 validation error detected: Value '35.162.65.187' at 'envir..

2 Answers2

1

For changing port on AWS you can do something like this:

sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000

For local machine:

rails server -p 80

But, Phlip absolutely right - you should learn rails on local machine with development environment. Step by step.

Michael Arkhipov
  • 737
  • 8
  • 19
0

You have two ways to preview applications on AWS Cloud9--through the preview URL (from clicking the Preview button) and from the public IP for the host (AKA the sharing URL). The Preview URL is a bit easier to run, but has a few limitations. Specifically:

  • You need to serve your content on 127.0.0.1:8080 (ports 8081 and 8082 work as well but have to be specified)
  • You can only access the URL when you are currently logged into the IDE and have the IDE open.
  • Only IAM users with access to the IDE can access the Preview URL. For instance, this won't work if you are calling this endpoint from another program.

You can read more about the Preview URL here: https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-preview-app

If you need to share this to people who don't have access to the IDE or you need to access the endpoint through a different program, you'll want to use the Sharing URL. This requires a bit of additional configuration, specifically, you'll have to:

  • Create a security group for the host that opens your selected ports to the main internet
  • Run the server through 0.0.0.0 instead of 127.0.0.1

You can see how to do this here: https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share

brycei
  • 125
  • 3