Creating CI/CD Pipeline for Serverless application with AWS CodePipeline
This article aims to give an in depth tutorial in building and deploying serverless application with AWS CodePipeline. In order to follow this tutorial you need to have some understanding on creating applications using serverless framework and basic AWS concepts.
First you need to create a buildspec file for your serverless. This file contains collection of build commands and related settings in yaml format. You can put this buildspec as a part of source code or define it in the AWS Code build. In this tutorial I will be placing this as a part of the source code.
- Buildspec file must be named as buildspec.yaml and placed in the root of the source directory.
version: 0.2 phases: install: commands: - echo install serverless framework - npm install -g serverless pre_build: commands: - echo install pre build commands - npm install build: commands: - echo deployment started `date` - echo deploy serverless framework custom codebase - sls deploy post_build: commands:
echo post build completed on `date`
Above gist contains simplest buildspec.yaml to build and deploy serverless application. Commands in the file are self explanatory if you have deployed apis using serverless framework. If you want to read more about , what you can do inside buildspec file , read the following article from AWS
Continuation of this article can be found on Medium.