Cloud9 is an integrated programming environment that can be run inside a web browser. We will demonstrate how to configure this environment for programming with Julia. The web page of Cloud9 can be reached at https://aws.amazon.com/cloud9/.
Running Julia inside the Cloud9 IDE in the AWS cloud
Getting ready
In order to use Cloud9, you must have an active Amazon Web Services (AWS) account and log in to the AWS management console.
Cloud9 can create a new EC2 instance running Amazon Linux or can connect to any existing Linux server that allows SSH connections and has Node.js installed. In order to start working with Julia on Cloud9, complete the following steps:
- Prepare a Linux machine with Julia installed (you can follow the instructions in the previous sections).
- Install Node.js. In Ubuntu 18.04.1 LTS, for example, the only step needed is to run sudo apt install nodejs.
- Make sure that your server is accepting external SSH connections. For an AWS EC2 instance, you need to configure the instance security group to accept SSH connections from 0.0.0.0/0—in order to do this, click on the EC2 instance in the AWS console, select Security Groups | Inbound | Edit, and add a new rule that accepts all traffic.
How to do it...
Once you have prepared a server with Julia and Node.js, you can take the following steps to use Cloud9:
- In the AWS console, go to the Cloud9 service and create a new environment.
- Select the Connect and run in remote server (SSH) option.
- For the username, type ubuntu if you use Ubuntu Linux, or ec2-user if you are running Amazon Linux, CentOS, or Red Hat (please note that this recipe has been tested with Ubuntu).
- Provide the hostname (public DNS) of your EC2 instance.
- Configure SSH authorization.
- In the Environment settings screen, select Copy key to clipboard to copy the key.
- Open an SSH connection to your remote server in a Terminal window.
- Execute the nano ~/.ssh/authorized_keys command to edit the file.
- Create an empty line and paste the public key content that you have just copied.
- Press Ctrl + X and confirm the changes with Y to exit.
- Now, you are ready to click the Next step button in the Cloud9 console. Cloud9 will connect to your server and automatically install all the required software. After a few minutes, you will see your Cloud9 IDE. By default, Cloud9 does not support running programs in Julia.Â
- Go to the Run menu and select Run with | New runner. Type the following contents:
{
"cmd" : ["julia", "$file", "$args"],
"info" : "Started $project_path$file_name",
"selector" : "source.jl"
}
- Save the file as JuliaRunner.run.
- Now, pressing the Run button will run your Julia *.jl file.
How it works...
The Cloud9 environment runs in your web browser. The browser opens a REST connection back to Cloud9's server, which in turn opens an SSH connection to your Linux instance (see the following diagram). This functionality will, in fact, run with any Linux server that accepts incoming connections from Cloud9 (more details on configuring other Linux servers with Cloud9 can be found at https://docs.aws.amazon.com/cloud9/latest/user-guide/ssh-settings.html):
Please note that this means that the EC2 instance supporting Cloud9 should allow incoming connections from the AWS Cloud9 infrastructure. In production environments, we recommend limiting traffic to the EC2 instance (via SecurityGroup) to the IP ranges defined for Cloud9. Detailed instructions can be found in Cloud9's documentation: https://docs.aws.amazon.com/cloud9/latest/user-guide/ip-ranges.html.
See also
The Cloud9 environment is being continuously updated by AWS; new features are being added frequently. For the latest documentation, we recommend looking at AWS Cloud9's user guide, available at https://docs.aws.amazon.com/cloud9/latest/user-guide/. In particular, it is worth looking at https://docs.aws.amazon.com/cloud9/latest/user-guide/get-started.html.