In this tutorial you will learn how to build a NodeJS application with CodeStar, which uses AWS Lambda, CodePipeline, CodeCommit and CloudFormation. You will also learn how to integrate your CodeStar project with JIRA.

The AWS services you use in this tutorial are within the AWS Free Tier.

Build a serverless application with AWS codestar requires an account

Create a Free Account

AWS Free Tier includes [ free tier details ] with [ AWS Product Name.]

View AWS Free Tier Details »

 


When you click here, the AWS Management Console will open in a new browser window, so you can keep this step-by-step guide open.  When the screen loads, enter your user name and password to get started. Then type CodeStar in the search bar and select CodeStar to open the console.

tmt_store-retrieve-file_1

(click to zoom)

tmt_store-retrieve-file_1

In this step, you will start a Node.JS project, backed by AWS Lambda.


a.  On the CodeStar home page, click on Start a project

TMT-serverless-01

(click to zoom)

TMT-serverless-01

b.  In the select template screen, choose the Node.js template with a Web application and AWS Lambda in it.

TMT-serverless-02

(click to zoom)

TMT-serverless-02

c.  Type in NodeJS-Serverless-Project for the Project name, and then click on Create Project

TMT-serverless-03

(click to zoom)

TMT-serverless-03

d.  On the next screen, Choose how you want to edit your project code, click on Skip, as we will do this in another section of this quickstart.

TMT-serverless-03b

(click to zoom)

TMT-serverless-03b

e.  Your project is now provisioning, and will be ready to edit in a few minutes.

TMT-serverless-04

(click to zoom)

TMT-serverless-04

In this step, you will connect your JIRA to your CodeStar project. This will allow you to track issues with this project.


a.   On the web page for your project, click on Extensions  

TMT-serverless-05

(click to zoom)

TMT-serverless-05

b.  Click on Add extension for Atlassian JIRA

TMT-serverless-06

(click to zoom)

TMT-serverless-06

c.  Follow the instructions on creating a JIRA instance (if you don’t already have one). Or skip to the next step if you do already have a JIRA instance.

TMT-serverless-07

(click to zoom)

TMT-serverless-07

d.  Once you’ve done this, type in the JIRA URL into the text box under “Add the JIRA URL to AWS CodeStar"

TMT-serverless-08

(click to zoom)

TMT-serverless-08

e.  Follow the instructions for JIRA in "Create the application link in JIRA”, “Configure incoming authentication in JIRA”, and "Connect your AWS CodeStar project to JIRA" then click on the “Connect” button.

TMT-serverless-08b

(click to zoom)

TMT-serverless-08b

f.  Click on Allow

TMT-serverless-09

(click to zoom)

TMT-serverless-09

g.  Your JIRA is now connected to your CodeStar project, and you will be able to see your JIRA issues under the JIRA panel

TMT-serverless-10

(click to zoom)

TMT-serverless-10

In this step, you will commit an update to your project. This will initiate a build with CodeBuild, and then a deployment to AWS Lambda with CloudFormation. This process will be managed by a Pipeline in AWS CodePipeline.


a.  On the main page for your project, there are several panels related to continuous deployment of your project, and the git repository that your project’s code is stored in.

TMT-serverless-11

(click to zoom)

TMT-serverless-11

b.  If you make a change to the code in the CodeCommit repository, it will automatically be deployed via CodePipeline. To do so, click on the Connect button in the Commit history panel.


TMT-serverless-13

(click to zoom)

TMT-serverless-13

c.  Click on the Copy button. If you have not setup your IAM user for CodeCommit access, click on the “Credential details” link and follow the instructions there.  

TMT-serverless-14

(click to zoom)

TMT-serverless-14

d.  In a Terminal window, run the following command to check out a copy of your code:

git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/nodejs-serverle
TMT-serverless-15

(click to zoom)

TMT-serverless-15

e.  Change your working directory to the git repo:

cd nodejs-serverle
TMT-serverless-16

(click to zoom)

TMT-serverless-16

f.  Open the index.html file.

nano public/index.html
TMT-serverless-17

(click to zoom)

TMT-serverless-17

g.  Add three exclamation marks to the “You just created a Node.js web application” text.

TMT-serverless-18

(click to zoom)

TMT-serverless-18

h.  Commit your changes.

git commit -a -m “updated index”
TMT-serverless-19

(click to zoom)

TMT-serverless-19

i.  Push your changes back to CodeCommit.

git push
TMT-serverless-20

(click to zoom)

TMT-serverless-20

j.  This change should now be displayed in the Commit history pane.

TMT-serverless-21

(click to zoom)

TMT-serverless-21

k.  After a few minutes, your Continuous deployment panel should reflect a new run of your CodePipeline. First your code will be build in CodeBuild. It will then be deployed with CloudFormation.  

TMT-serverless-23

(click to zoom)

TMT-serverless-23

l.  Once this has succeeded, you can see the Endpoint for your NodeJS application.

TMT-serverless-24

(click to zoom)

TMT-serverless-24

m.  If you click on the link for the endpoint, you will see that your changes have been deployed to your application.

TMT-serverless-25

(click to zoom)

TMT-serverless-25

You can easily delete the serverless application from the CodeStar. In fact, it is a best practice to delete resources you are no longer using so you don’t keep getting charged for them.


a.  In the CodeStar console, under your project, click on Project.

TMT-serverless-26

(click to zoom)

TMT-serverless-26

b.  You will see a listing of all of the resources comprising your project. In order to delete them click on Delete project.

TMT-serverless-27

(click to zoom)

TMT-serverless-27

c.  To confirm deletion of the project, type in the name of your project, and then click on Delete. If you would like to delete the resources of the project as well, uncheck the Keep associated AWS resources but delete project in AWS CodeStar checkbox.

TMT-serverless-28

(click to zoom)

TMT-serverless-28

You have now created a NodeJS application with AWS CodeStar!

Now that you have created a simple serverless web application with AWS CodeStar, here are some other useful ways to use CodeStar.

Integrate Your IDE with AWS CodeStar

Write and develop code in your preferred environment, then push to CodeStar.
Integrate you IDE with AWS CodeStar »

Working with AWS CodeStar Teams

Collaborate with others by granting ohers access to AWS CodeStar projects.
Add others to your AWS CodeStar Team »

Yes
No