Create Development Environment

Please complete RDS Database Setup first, as it takes a while for a database to spin up.

Launch Ec2

  1. Start by logging into the AWS Console.
  2. On the AWS management console home page, search for “Ec2” in the “Find Services” search box. Press enter or click the “Ec2” service that populates in the fast search.
  3. Click big blue “Launch Instance” button.
  4. On “Step 1: Choose an Amazon Machine Image (AMI)“, Select the “Amazon Linux 2 AMI (HVM), SSD Volume Type” instance. We want the 64-bit (x86) option which is the default.
  5. For “Step 2: Choose an Instance Type”, select “t2.micro” and click “Next: Configure Instance Details”
  6. On the “Configure Instance Details” page. Change the “IAM Role” to “cloud9-admin-instance-profile”
  7. On the same page in the “Advanced Details” section, add the following script to the user data:

    #!/bin/bash
    yum update -y
    rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
    yum install dotnet-sdk-3.0 -y
    cat > /tmp/subscript.sh << EOF
    # START
    echo "Setting up NodeJS Environment"
    curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
     
    echo 'export NVM_DIR="/home/ec2-user/.nvm"' >> /home/ec2-user/.bashrc
    echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm' >> /home/ec2-user/.bashrc
     
    # Dot source the files to ensure that variables are available within the current shell
    . /home/ec2-user/.nvm/nvm.sh
    . /home/ec2-user/.bashrc
     
    # Install NVM, NPM, Node.JS & Grunt
    nvm install v12.7.0
    
    # Install Amazon Templates and Tools
    dotnet new -i Amazon.Lambda.Templates
    dotnet tool install -g Amazon.Lambda.Tools
    dotnet tool install -g Amazon.ECS.Tools
    dotnet add package System.Data.SqlClient --version 4.8.0-preview1.19504.10
    dotnet add package AWSSDK.SecretsManager --version 3.3.101.37
    EOF
     
    chown ec2-user:ec2-user /tmp/subscript.sh && chmod a+x /tmp/subscript.sh
    sleep 1; su - ec2-user -c "/tmp/subscript.sh"
  8. All the other settings can remain with default settings. click “Next: Add Storage”

  9. We don’t need to change any of the storage settings. click “Next: Add Tags”

  10. Add a tag with:

    1. key=Name
    2. value= Cloud9 Development Machine
  11. Click “Next: Configure Security Group”

  12. On “Step 6: Configure Security Group”, Change:

    1. “Security group name” = “SSH Open to All”
    2. “Description” = “This security group alls SSH access to our instance from anywhere”
  13. Click “Review and Launch”. This will take you back to the Ec2 instances page.

  14. The “Select an existingkey pair or create a new key pair” dialog will pop up. In the drop down select “Proceed without a key pair” and check the “I acknowledge…” box.

  15. Click “Launch Instance.”

  16. Select the “Cloud9 Development Machine” instance and review the content in the “Description” tab.

  17. Make note of the “IPv4 Public IP”. We will need it in the next steps.

Launch Cloud9

  1. Start by logging into the AWS Console.
  2. On the AWS management console home page, search for “Cloud9” in the “Find Services” search box. Press enter or click the “Cloud9” service that populates in the fast search.
  3. On the Cloud9 getting started page, click “Create Environment”.
  4. On the “Name environment” page, give your environment a name and description. Click “Next Step”
  5. On the “Configure settings” page:
    1. Environment settings = “Connect and run in remote server (SSH)”
    2. User = “ec2-user”
    3. Host = the IPv4 Public IP of the ec2 we launched in the previous step
    4. Port = leave the port default of “22”
  6. Next we need to SSH key to the Ec2 instance.
  7. Duplicate the browser tab (this will leave the Cloud9 setup window and give us a new window to do the Ec2 work).
  8. In the new browser tab click “Services” in the top left, search for “Ec2” and press enter.
  9. From the Ec2 home page select “Instances” on the left hand navigation.
  10. Find the “Cloud9 Development Machine” instance and select the box next to the instance name.
  11. Once selected, click the “Connect” button.
  12. From the “Connect To Your Instance” dialog, select “EC2 Instance Connect.” Leave the default user (ec2-user).
  13. Click “Connect”
  14. Once the connection is established, open the “~/.ssh/authorized_keys” file with nano directory

    nano ~/.ssh/authorized_keys
    
  15. Go back to the Cloud9 tab and and click “Copy key to clipboard”

  16. Paste the key into the “authorized_keys” file on the line below the existing entry.

  17. Save (Ctrl+O and then enter) and exist the file (ctrl+X)

  18. Close the the broswer tab that has the connection to Ec2.

  19. Go to the Cloud9 tab. Click “Next Step.”

  20. On “Review” page, click “Create Environment.”

  21. The Cloud9 installer will ask if it is ok to install some dependencies. Click “Next”, and “Next” again.

  22. It will ask if you want to install “C development tool”, type “y” and hit enter.

  23. After those tools are installed, Click “Next” and then click “Finish”

  24. The Cloud9 IDE will load in this tab.

Congratulations, you the development environment is ready.