.NET Core on the AWS Cloud9 IDE

.NET Core on the AWS Cloud9 IDE

Do you want to build a .NET application for AWS, but don't want to spend three hours installing Visual Studio? The Cloud9 online IDE might be for you. Cloud9 integrates seamlessly with Amazon's cloud services and allows you to write code and manage AWS resources without leaving your web browser.

Amazon Web Services acquired Cloud9 back in 2016, but just a few weeks ago at re:Invent they unveiled it as an official AWS service with deep integration to the rest of the ecosystem.

Cloud9 looks impressive, but it lacks native support for .NET development. From a code editing and syntax perspective it supports C#, but that's about it.

This is because under the covers Cloud9 interacts with an Amazon Linux EC2 instance*. This instance is used for code storage, compiling, debugging, etc. It's actually pretty slick. Of course, plain old .NET Framework doesn't really run on Linux so that's ruled out. But .NET Core works fine.

* you can also connect Cloud9 to a custom instance of your choosing via SSH.

In order to actually run .NET Core code in Cloud9, two tasks need to be completed:

  1. Install .NET Core on the Cloud9 instance
  2. Create the .NET Core runner through Cloud9

This post walks through both of these steps. Note: this guide assumes you have already setup a Cloud9 environment through your AWS account.

Installing .NET Core

The default underlying instance for Cloud9 runs the Amazon Linux OS, which is a derivative of CentOS and RHEL. Microsoft publishes .NET Core SDK packages for both CentOS and RHEL, but neither of them work. There were a variety of dependency issues that probably could have been sorted out, but since I just wanted to get a POC running I wanted a faster route.

Thankfully, Microsoft also publishes a generic binary for Linux which seems to work fine. To make this work we need to install one dependency, download the SDK, and add it to the path.

The following steps can be completed through either the terminal built into Cloud9, or an SSH connection directly to the Cloud9 EC2 instance. I did it all through Cloud9.


libunwind seems to be the only required dependency that is not included with the SDK.


sudo yum update
sudo yum install libunwind


Install the .NET Core SDK

This step downloads the SDK from Microsoft, unzips it into the Cloud9 user home directory, and adds that directory to the path.


cd ~/
wget https://download.microsoft.com/download/D/7/2/D725E47F-A4F1-4285-8935-A91AE2FCC06A/dotnet-sdk-2.0.3-linux-x64.tar.gz
mkdir -p $HOME/dotnet
tar zxf dotnet-sdk-2.0.3-linux-x64.tar.gz -C $HOME/dotnet
export PATH=$PATH:$HOME/dotnet


Finally, open <inlinecode>~/.bash_profile<inlinecode> and add <inlinecode>$HOME/dotnet<inlinecode> to the path variable in there. After you save, run: <inlinecode>source ~/.bash_profile<inlinecode>

.NET Core is now installed on the Cloud9 instance and is ready to be used. Try running the "dotnet" command to make sure none of the steps above were missed.

While we're in the command terminal, let's create a templated .NET Core app. Make sure you're still in the /home/ec2-user/environment folder and run <inlinecode>dotnet new console<inlinecode>. That may take a minute or so to cache some files, then you'll end up with a "Hello, World!" console app written in C#.

The Cloud9 Runner

Cloud9 uses what they call "runners" to actually run the code that you write in Cloud9. A runner is basically a JSON based definition of how Cloud9 should execute the code you create in the IDE. It describes which program should be run (node, php, python, etc.) and what parameters should be passed to it. There's probably quite a bit more that can be done via the runner as well, but I haven't dug that deep.

In order to make .NET Core work, we need a runner that can execute "dotnet". You can do a lot with runners, but all we're going to do is tell it which command to run. Read more about their capabilities here.

Creating a runner is done right through the IDE. Click on Run -> Run With -> New Runner. The default JSON will appear. Change it to the following:


   "cmd" : ["dotnet", "run"],
   "info" : "Started $project_path$file_name",
   "env" : {}


All that says is that when Cloud9 is told to run, the runner should execute "dotnet" with the "run" parameter.

Save the file to its default /.c9/runners folder. The name of the file is what will appear elsewhere in the IDE.

Click Run -> Run Configurations -> New Run Configuration.

At the bottom of the Cloud9 window, make sure "Program.cs" is in the Command text box and that your new runner is selected in the dropdown.

Click the green Run button.

That's it! After a few seconds you should see your program's Console.WriteLine() message in the Run window.

Closing Thoughts

The ideas in Cloud9 are cool. Immediate access to AWS resources is definitely convenient and the collaborative tools look great. I didn't play with the debugger at all (that would open another can of worms to setup for .NET Core), but at first glance it seems to have all of the standard features you would expect.

Finally, the idea of having the entire dev environment including databases, app servers, etc. running out on an EC2 instance rather than my machine is definitely appealing. We'll see if these benefits outweigh the need to make a tooling change and also pay for each second that the environment is running.

Get your project started today

Get in Touch