.NET Core development in the browser using AWS Cloud9

Since I don't have Windows installed anymore but still do some .NET development from time to time I decided to try AWS Cloud9. I really like the idea of running my environment in a browser and be able to connect to it from any machine with a browser. If you are not familiar with AWS Cloud9, this is how we describe it in the AWS Portal

AWS Cloud9 allows you to write, run, and debug your code with just a browser. With AWS Cloud9, you have immediate access to a rich code editor, integrated debugger, and built-in terminal with preconfigured AWS CLI. You can get started in minutes and no longer have to spend the time to install local applications or configure your development machine.

In this short "getting started" installation guide I will show how you get your environment up and running and how to connect it to an EC2 instance.

First you need to log in to your AWS Console and go to the AWS Cloud9 section. Click the big orange button with the text "Create Environment". I named mine "DotNetCoreBlog". On the next screen we choose to "Connect and run in remote server (SSH)". We will use a ready made Ubuntu Linux AMI with .NET Core and Powershell preinstalled but we have to create an instance before we continue. Set ubuntu as the username and make sure to copy the public SSH key. This will be used by the Cloud9 environment to connect to the instance we will create.

createnew

After we have copied the key we need to head over to the EC2 console to create a new instance for our environment. Make sure you are in the same region as you started your Cloud9 environment in. Hit the "Launch instance" button and scroll down until you find ".NET Core 2.x with Ubuntu Server something". There's also an official AMI with Amazon Linux but in this case we are going with Ubuntu. You are free to pick the one you are most familiar with, just remember to change the login name we entered before if you go with Amazon Linux.

ubuntuami

Next you want to pick an instance size. If you are just trying things out go for the t2.micro. In step 3, create a new IAM role with access to the things you are planning to use. You also want to enter some custom thing in User Data. User Data contains command that are run when the instance launches. We want to add our publish ssh key so AWS Cloud9 can access our instance. Also AWS Cloud9 needs both nodejs and python 2.7 installed on the host for it to function correctly. In our case it will look like this.

userdata

Pick as much disk as you think you'll need and make sure to pick a security group that allows SSH. There are lists with AWS Cloud9 specific IP adresses if you want to do automation but for you can allow from everywhere. After your instance has launched, get the public IP and head back over to the create AWS Cloud9 dialog where you enter the IP adress in the host field.

Verify and create environment. You well get a dialog that want to install things for AWS Cloud9 to run correctly. Just accept and wait.

After a short while you should be in your new development environment and ready to hack away. Make sure to turn off your instance when you are not using to save money. There's a setting in AWS Cloud9 where you can choose to turn the instance off after 30min.

Enjoy!

Show Comments