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(https://console.aws.amazon.com/codepipeline/home)
  • 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 mails.zip *
  • Create a folder with name mails and the new file(sending_email.py) in the folder
  • Install the required packages in the folder using pip
  • Write a script for sending the mail using aws ses service in sending_email.py.
  • Create a zip folder with the following command:
  • Go to aws Lambda console(https://console.aws.amazon.com/lambda/home)
  • 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


Need any Help in your Project?Let's Talk

Latest Comments
AWS Lambda - Best Practices

After Years of Developing Lambda Scripts from creating Serverless Applications to Pipelining your Tasks, Here are the Best Practices that we follow.

Continue Reading...
Autoscaling Application with AutoScaling Groups and AWS LoadBalancer

Autoscaling Application with AutoScaling Groups and AWS LoadBalancer

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

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

Continue Reading...
AWS tips and tricks to optimize cost and performance for better ROI

Best Practices of AWS cost and Performance Optimization

Continue Reading...
How to process message queuing system by amazon SQS

How to process attributes of message queuing system by amazon SQS using Boto3

Continue Reading...
Easy and Fast way to implement AWS Lambda service

We are going to use a simple application called Gordan to prevent creating a lambda function and triggering actions which involves time taking and repetitive …

Continue Reading...
How To Send And Receive Email With Django And Amazon SES

django-ses-gateway a pluggable Django application is used for sending mails from your verified domains and verified emails. We can also use django-ses-gateway for receiving messages …

Continue Reading...
Deploy Django using CloudFormation Template

CloudFormation helps in Using JSON templates to describe the resources needed from aws. With this approach, we don't have to repeat the same manual configuration …

Continue Reading...
How to Mount S3 Bucket on Local Disk

It all starts with FUSE, FUSE is File System User Space. Operating Systems have Kernel Space and User Space. Kernel Space is where low level …

Continue Reading...
Using AWS Lambda with S3 and DynamoDB

AWS lambda is handy tool for event driven computation, here we will learn how to configure and setup lambda function so to run our function …

Continue Reading...
How to access EC2 instance even if pem file is lost

Accessing the EC2 instance even if you loose the pem file is rather easy.

1. First, create a new instance by creating new access …

Continue Reading...
Deploying Django project on Elastic Beanstalk

Here You can learn about how to setup and deploy a Django application to Amazon Web Services (AWS).

Tools/technologies used:
Python v2.7
Django v1.7
Amazon …

Continue Reading...
how to setup custom domain for amazon cloudfront

We all want our own domain name to be setup for cloud front instead of amazon default cloud front domain name. We need two things …

Continue Reading...
Paginating S3 objects using boto3

When using Boto you can only List 1000 objects per request. So to obtain all the objects in the bucket. You can use s3's paginator.

Continue Reading...
Creating Elastic Search Cluster (EC2, cloud-aws Plugin)

While handling Large amounts of data with elasticsearch, you may run out of server capacity or compute power, Forming a Elasticsearch cluster will reduce the …

Continue Reading...
Configuring and Testing Load Balancer in AWS EC2

When You have an application that is serving Huge Customer Base, so will be your Traffic. Sometimes The Application simply stops responding. We can use …

Continue Reading...
Django Hosting on Amazon EC2 with wordpress on same domain

Configuring the Wordpress as subdirectory can be tricky. In this tutorial we will Setup a Django Website alongside a wordpress blog.

Continue Reading...
Amazon SES - Handling Bounces and Complaints

In general while sending emails, we will prepare some recipient addresses as our mailing list, which are valid and our recipients want and expect our …

Continue Reading...
Amazon AWS IAM Roles and Policies

When You want to Provide access to Amazon Web Services Console or if you're planning to provide REST API Keys to your Developers of a …

Continue Reading...
CORS with Amazon S3 and CloudFront

We struggle to load fonts from CloudFront because of CORS.

CORS - Cross Origin Resource Sharing is a security measure to block macious scripts or …

Continue Reading...

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