top of page

AWS Cloud9 IDE (C++)

Learn AWS Cloud9 and test an application


Objectives:

  1. Learn AWS Cloud9 console to create and then open an AWS Cloud9 development environment.

  2. Learn to use the AWS Cloud9 IDE to create and test an application.

Step 1:

Cloud9 operates in some specific regions for now. So, we have to switch to one of those operative Regions.

In AWS Console, top blue bar, from Region drop down, select US East (Ohio) us-east-2.

Step 2:

Go to Cloud9 Service. Click on Create Environment.

  • Provide the following configuration:

  • Environment Name: MyCloud9

  • Description: Cloud9 IDE for CloudPlusPlus Tutorial

Go to Next Step.

Confirm the following list of default selected choices:

  • Environment type: Create a new EC2 instance for environment (Direct access)

  • Instance type: t2.micro (1 GiB RAM + 1 vCPU)

  • Platform: Amazon Linux 2 (recommended)

Proceed to Next Step. Review and click on Create environment.

Step 3:

You will have the Cloud9 IDE ready in some time. A window as below is visible.

In the bottom part of the screen, a Terminal Window is visible. If not go to the Window option in Menu Bar of Cloud9 IDE and click on New Terminal.

Type the following command to check if g++ is installed. g++ --version

It will give the g++ installed version.

If g++ isn't installed, run the following command.

  • sudo yum groupinstall "Development Tools"

Run g++ --version again to confirm that the compiler has been installed.

Now go to File -> New File.

Type in the following code:

#include <iostream>

#include <string>

using namespace std;

int main(int argc, char* argv[])

{

cout<<"Hello World!"<<endl; cout<<"The sum 2 and

3 is 5"<<endl; int sum; int a = stoi(argv[1]); int b

= stoi(argv[2]); sum = int(a+b); cout<<"The sum of

"<<a<<" and "<<b<<" is : "<<sum;

return 0;

}

Save this file (Ctrl+S) by name of cloudpp.cpp.

Step 4:

In Menu Bar click on Run -> Run Configurations -> New Run Configuration.

On the [New] - Stopped tab, enter cloudpp.cpp 5 6 for Command. In the code, 5 represents argv[1], and 6 represents argv[2].

The output will be visible in the window.

Thus, we have successfully created a basic Cloud9 IDE and used it to run a CPP code.

Step 5:

  • If you no longer need the IDE, you may delete it.

  • In the top side of screen, click on the Cloud9 logo.

  • Further Click on Go To Your Dashboard.

In the Cloud9 Dashboard, select your IDE and click on Delete. Type “Delete” in the next screen to confirm deletion.

Note: Switch back to your usual operating Region.



Was this document helpful? How can we make this document better? Please provide your insights. You can download PDF version for reference.

We provide the best AWS training from Pune, India.

For aws certification contact us now.

Recent Posts

See All
bottom of page