Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
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

Product type Book
Published in Nov 2018
Publisher Packt
ISBN-13 9781788998369
Pages 460 pages
Edition 1st Edition
Languages
Authors (2):
Bogumił Kamiński Bogumił Kamiński
Profile icon Bogumił Kamiński
Przemysław Szufel Przemysław Szufel
Profile icon Przemysław Szufel
View More author details
Toc

Table of Contents (18) Chapters close

Title Page
Copyright and Credits
Dedication
About Packt
Contributors
Preface
1. Installing and Setting Up Julia 2. Data Structures and Algorithms 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 1. Other Books You May Enjoy Index

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 runsudo 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 from0.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.

Note

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, typeubuntu if you use Ubuntu Linux, orec2-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. PressCtrl + Xand confirm the changes withYto 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 runnerType the following contents:
 {
"cmd" : ["julia", "$file", "$args"],
"info" : "Started $project_path$file_name",
"selector" : "source.jl"
 }
  1. Save the file asJuliaRunner.run.
  2. Now, pressing the Run button will run your Julia *.jlfile.

Note

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 (viaSecurityGroup) 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 athttps://docs.aws.amazon.com/cloud9/latest/user-guide/. In particular, it is worth looking athttps://docs.aws.amazon.com/cloud9/latest/user-guide/get-started.html.

You have been reading a chapter from
Julia 1.0 Programming Cookbook
Published in: Nov 2018 Publisher: Packt ISBN-13: 9781788998369
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 €14.99/month. Cancel anytime}