AWS Cloud9: Cloud Development
AWS Cloud9 is a cloud based development environment, which enables you to develop inside the environment where your code will run. Cloud9 provides us indeed a virtual machine, which is fully integrated with the underlying AWS APIs, e.g. one of the popular serverless concept, cloud lambda environment. The security perspective is also pretty simplified to improve the development progress. Another point of view is the communication between components are fast, since the development environment is close to the other services.
In this tutorial, we will go over the required steps for using AWS Cloud9 environment by showing screenshots and explaining them.
- In the AWS web console, simply search the
cloud9
service, it will appear as below
- The next step is directly to click the
Create Environment
on the displayed page.
- Cloud9 environment creation is composed of three steps: 1) Name environment, 2) Configure settings, and 3) review all.
- Naming environment is the place where you can assign a logical name and describe the purpose of the environment, as shown below.
- In the Environment settings, we configure the virtual image on which we develop the project. As usual, the default selections are recommended, in case you select others, please note that they may cost extra. We create EC2 instance with instance type
t2.micro
using theAmazon Linux 2
operating system. To access the other services, the IAM role permission is generated for us, an additional IAM role management is not needed. If you want to inform yourself about IAM, you may visit my previous tutorial [IAM role] focusing on its logic. In this example, there is no need to create a separate virtual private cloud (VPC), if you aim to do itNetwork Settings
is the section where you need to select your own VPC, otherwise a default one is selected for us.
The next step is the review page to analyze whether the selections and configurations are as expected.
After pressing the “Create environment” it will take a short amount of time to have the cloud9 environment. It will result with the following page, on the left side you will have the code panel, at the bottom the terminal and many other control buttons at the top side and on the right side.
You can add all your code on the left column by clicking File>Upload Local Files
Or you can clone a repository from other online repositories or initialize it.
Your project may also require other AWS services, and aws
icon on the left panel enables us to generate and connect with the project to be developed. Probably, this is the most important feature apart from the AWS role based permissions. As you see in the following figure, there is no function under the Lambda folder.
In case, you want to add a lambda function, right click
on the Lambda
folder will display three possible options as below, and by following the steps we can create a lambda.
After adding this document, I noticed there are other medium articles that share the similar content [1], however, some steps are changed over time.
The completion of the above steps will end up our initial empty folder with an AWS lambda source code as seen below.
The initial lamda code includes many details and allow us to use and even deploy the lambda project. For example, invoking a hello world function like sam local invoke HelloWorldFunction --event events/event.json
or directly starting a local api sam local start-api
. The execution of these commands on the console resulted as below.
Summary
In this tutorial, the intention was to refresh our minds about AWS Cloud9 environment, and see what is the current development environment in AWS world.
References
1 — https://medium.com/analytics-vidhya/how-to-create-an-aws-lambda-function-in-cloud9-86255e456747