Tuesday, December 3, 2024
HomeCloudAWSIntroduction about CodeStar and how to build serverless web service with codestar

Introduction about CodeStar and how to build serverless web service with codestar

CodeStar designed to simplify your AWS development workflow and help you easily create, test, and deploy your applications on AWS, and it’s completely free!

Introduction

CodeStar supports five popular programming languages: Java, JavaScript, PHP, Ruby, and Python. It provides a wide variety of templates for these languages when launching applications on EC2, AWS Lambda, and AWS Elastic Beanstalk. These templates are used to provision your entire underlying AWS infrastructure in minutes, so you can get right to work.

CodeStar provides a unified project dashboard which allows you to monitor application activity by tracking commits, builds, tests, and deploys across all stages of development, and view your application’s performance statistics.

CodeStar also integrates with Atlassian’s JIRA for easy issue tracking and project management, all from the same dashboard, and comes with built-in role-based access policies, making it easy to manage access for project owners, contributors, and viewers, across all services simultaneously.

Getting Started

Amazon has a pretty good tutorial for getting started with CodeStar, but I wanted to go through the process first hand and share my experience.

In this tutorial, I’ll go through how to create and deploy an application using CodeStar and then I’ll talk about some of the pros and cons of using CodeStar, some of CodeStar’s limitations, and what else is out there.

Let’s discuss details necessary steps to get a serverless web services project running with AWS CodeStar.

Once you login into the AWS Console, go to the AWS CodeStar dashboard. From there we click on “Start a Project”.

Once you click, it will pop to create a IAM service role (for first time). Just click create role to create a IAM role with necessary permissions. How its matter? “AWS CodeStar would like permissions to administer AWS resources and IAM permissions on your behalf. IAM users with CodeStar Full Access will be able to create and manage CodeStar project resources and grant other IAM users in this account access to those resources

Creare codestar service roleThe first step is to create a new template. For this example, I’ll choose the GO over AWS Lambda.

choose a codestart project templateThen we set up a name as “awstest”. Take into account that AWS CodeStar will offer to administer the AWS resources for ourselves by creating assigning itself a role with enough permission. We can opt-out of this by deselecting the box at the end of the form

Codestar project detailsIf we investigate what the form is presenting us, we’ll see what AWS CodeStar is going to set up for us.

codestar project details reviewFirst, it will initialize a new repo on AWS CodeCommit for us. If you have never heard of CodeCommit, it provides a service like GitHub, but all the repositories are private by default. The free tier allows up to 5 active users, 50 GB per month of traffic and 10000 git requests per month. It is a great tool if you need to keep your code private, which is usually the case when you are working in an Enterprise environment.

code sectionNext, is AWS CodeBuild. This tool from AWS was designed to manage all the steps to build our source code. It is great to run tests, build our code, and pipe its results into a CI/CD workflow. For our Node-based project, it will bundle our code, run our test them, and pass the build to AWS CloudFormation for deployment.

project resource

The last step of the chain is to set AWS CloudWatch to monitor all the pieces of our project.

Then we are offered a choice to integrate our project into our development environment. There are choices of the AWS Toolkit to use with Visual Studio or Eclipse. Since I only use a text editor for all my coding, I prefer the third option, which is to handle the project from the command line.

pick a development tool

Clicking each of the options will show a tutorial with the steps needed to integrate the project with our tools. The command line option only asks you to clone the created repository to your machine. You’ll find very thorough explanations on how to clone a CodeCommit repository on your specific OS.

After clicking “Next” we are done with the setup, and we are greeted by our project monitoring dashboard. There are a lot of widgets we can take advantage of. We can see our project history, its history, our continuous deployment pipeline, etc. It also provides quick links to configure the main parts of our project, like its repo, build tools, deploy tools, pipeline setup, and team management. Here is a list of all the resources that were created for us.

codestar buildflow

After cloning the project to our local machine we’ll see a list of files. The buildspec.yml contains all the build information of our project. By default, the app will just run npm install to install the project dependencies and then it will generate a template file to run through CloudFormation to deploy the app.

Lastly, we have the template.yml file, which is a CloudFormation template our default infrastructure setup. We can modify this file to handle our entire application infrastructure on AWS, without having to interact anymore with the AWS console or its cli.

To see how the project is working we can update the app.js file, commit the changes, and then push to origin to trigger the continuous deployment pipeline.

When the deployment is done, we can check that the update was successful by checking our API Gateway endpoint. It should know show are greetings from AWS CodeStar.

codestar application endpointAs this is very simple code we have seen, its just give you an idea. But we must use some real-time for more understanding. We will work on real-time code and will add more that is coming posts.

Happy Reading with FoxuTech…!!!

For more: AWS Reference

RELATED ARTICLES
- Advertisment -

Most Popular

Recent Comments