How to Build and verify an application using aws codepipeline and creating custom events with lambda

For few applications, updates will be released frequently to easy user interaction, performance, usage. They need to check all the cases(Design, module working flows) are working fine in all the test cases. So we need to run the test cases to check the functionality of all the module work flows. After verifying the test cases, we need to update the code to live server. We’re having a series of steps before releasing a software. In such case, AWS code pipeline will be used for running the test cases, verifying the test cases, updating the live with the updates.

AWS Code pipeline will be used for automating all the required steps to release the application updates. We can also use it in different stages like development(staging), live server. So different pipelines will be there for development and live server.

In this blog post, after updating the code pipeline will be run, and it’ll check for application status, send an email if the status is 200. If require any support get in touch with our AWS Consultant to make your work easy

Steps to deploy an application with AWS code pipeline:

  • Visit aws codepipeline console(
  • Enter the pipeline name
  • Next, it’ll ask for source provider i.e your code locator for ex: Github, S3. Choose any of the option
  • In this blog post, we’re deploying it from the github, choose github. Click on connect to github
  • After connecting with GitHub, choose your application repository and branch, click on Next Step
  • Select Build Provider as AWS Code Build, choose any of the application in code builder, click on NEXT.
  • Choose deploy as No Deploy, because we’re not deploying the code.
  • Choose  AWS-CodePipeline-Service to give permissions for codepipeline
  • click on create a pipeline to create a pipeline.

Now It’ll run the test cases and verify it. Return success message if the test cases are passed otherwise returns failed message

We need to add an AWS Lambda service to create a custom event for sending notification emails if application status returns 200.

Steps to create a lambda service:

     install boto -t . -- This will install the requirements with in the folder.
cd /mails/ zip -r -D *
  • Create a folder with name mails and the new file( in the folder
  • Install the required packages in the folder using pip
  • Write a script for sending the mail using aws ses service in
  • Create a zip folder with the following command:
  • Go to aws Lambda console(
  • Click on Create Function
  • Give function name, programming language details, a role for the function. It’ll create a new function
  • In the Function Code block, Choose entry type as Upload a .zip file, click on upload
  • After the save the function, test it.
  • It will return the response if required packages are installed, otherwise, it’ll return a detailed error message

Now we need to link aws lambda to the aws codepipeline. For that click on edit in the pipeline view page.

  • Click on add new stage && add new action
  • Choose action category as Invoke, Give a name to a particular action, choose lambda
  • Select AWS Lambda Function name, and the parameters if it is required, click on add action.
  • It’ll add to the codepipeline, run the script for every pipeline from now onwards.

Posted On 30 October 2018 By MicroPyramid

About Micropyramid

Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.

Need any Help in your Project?Let's Talk


Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties