Claudiajs is a great command-line tool that expedites the infrastructure creation process for serverless applications on AWS. It configures AWS services together for you so you don't have to and you can focus on building your app.
Why would you want a deployment solution for Claudiajs if you could just do
Claudia updateto push updates to your application?
Here are a few reasons why you may want to have a continuous deployment for Claudia.
- You may want to track all the deployments that are being done by your team.
- You may want to be able to perform rollbacks on the fly in case something funky gets deployed.
- You may want to limit certain deployment targets to only certain team members
Lets get started!
I assume you already have a Claudiajs application ready to work with. If you do not have one, create a Claudiajs Hello World lambda application and push it to a Github repository.
Create an AWS CodeBuild
The CodeBuild services are responsible for deploying the Claudiajs application. Pretty clever use of an AWS Service right? Navigate to the AWS CodeBuild Service and create a new project.
Fill in necessary input parameters. Make sure to use the Nodejs runtime in the environment. Add the following to the build command:
npm install claudia -g & claudia update. What this command does it installs Claudiajs on the build server and uses it to deploy the application. Click save and let's move on to the CodePipeline.
Note* make sure to input an Artifact output. This is necessary for successfully setting up a CodePipeline.
CodePipeline is responsible for detecting changes in the application repository and piping the application to the CodeBuild when changes in the repo have been detected.
Navigate to the CodePipeline and fill in the details. Create a CodePipeline and for the Build step, choose CodeBuild and select the project you made in the previous step.
Click Next Step and for Deployment choose No Deployment. Click Save and you should be good to go.
Now each time there is a change in the Github repo, CodePipeline will detect the change, pull the application from the repo and pass it to the CodeBuild. The CodeBuild then deploys the serverless application using Claudiajs configurations.
There is more!
I created and open sourced a Cloudformation that builds the entire Continuous Deployment infrastructure for you with a click of a button.
Check out the Cloudformation here :