Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Julia 1.0 Programming Cookbook

You're reading from   Julia 1.0 Programming Cookbook Over 100 numerical and distributed computing recipes for your daily data science work?ow

Arrow left icon
Product type Paperback
Published in Nov 2018
Publisher Packt
ISBN-13 9781788998369
Length 460 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Przemysław Szufel Przemysław Szufel
Author Profile Icon Przemysław Szufel
Przemysław Szufel
Bogumił Kamiński Bogumił Kamiński
Author Profile Icon Bogumił Kamiński
Bogumił Kamiński
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Installing and Setting Up Julia 2. Data Structures and Algorithms FREE CHAPTER 3. Data Engineering in Julia 4. Numerical Computing with Julia 5. Variables, Types, and Functions 6. Metaprogramming and Advanced Typing 7. Handling Analytical Data 8. Julia Workflow 9. Data Science 10. Distributed Computing 11. Other Books You May Enjoy

Running Julia inside the Cloud9 IDE in the AWS cloud

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/.

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:

  1. Prepare a Linux machine with Julia installed (you can follow the instructions in the previous sections).
  2. Install Node.js. In Ubuntu 18.04.1 LTS, for example, the only step needed is to run sudo apt install nodejs.
  3. 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.
In the GitHub repository for this recipe, you will find the JuliaRunner.run file that contains the configuration for the AWS Cloud9.

How to do it...

Once you have prepared a server with Julia and Node.js, you can take the following steps to use Cloud9:

  1. In the AWS console, go to the Cloud9 service and create a new environment.
  2. Select the Connect and run in remote server (SSH) option.
  3. 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).
  4. Provide the hostname (public DNS) of your EC2 instance.
  5. Configure SSH authorization.
  6. In the Environment settings screen, select Copy key to clipboard to copy the key.
  7. Open an SSH connection to your remote server in a Terminal window.
  8. Execute the nano ~/.ssh/authorized_keys command to edit the file.
  9. Create an empty line and paste the public key content that you have just copied.
  10. Press Ctrl + X and confirm the changes with Y to exit.
  1. 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. 
  2. 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"
}
  1. Save the file as JuliaRunner.run.
  2. Now, pressing the Run button will run your Julia *.jl file.
Please make sure that the Cloud9 folder points to /.c9/runners.

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

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image