FenryrMKIII
FenryrMKIII

Reputation: 1198

AWS Lambda CI/CD process

I am trying to understand the correct way to setup my project on AWS so that I ultimately get the possibility to have CI/CD on the lambda functions. And also to ingrain good practices.

My application is quite simple : an API that calls lambda functions based on users' requests.

I have deployed the application using AWS SAM. For that, I used a SAM template that was using local paths to the lambda functions' code and that created the necessary AWS ressources (API Gateway and Lambda). It was necessary to use local paths for the lambda functions because the way SAM works does not allow using existing S3 buckets for S3 events trigger (see here) and I deploy a Lambda function that is watching the S3 bucket to see any updated code to trigger lambda updates.

Now what I have to do is to push my Lambda code on Github. And have a way that Github pushes the lambda functions' code from github to the created S3 bucket during the SAM deploy and the correct prefix. Now what I would like is a way to automatically to that upon Github push.

What is the preferred way to achieve that ? I could not find clear information in AWS documentation. Also, if you see a clear flaw in my process don't hesitate to point it out.

Upvotes: 0

Views: 580

Answers (2)

Yayotrón
Yayotrón

Reputation: 1869

What you're looking to do is a standard CI/CD pipeline.

The steps of your pipeline will be (more or less): Pull code from GitHub -> Build/Package -> Deploy

You want this pipeline to be triggered upon a push to GitHub, this can be done by setting up a Webhook which will then trigger the pipeline.

Last two steps are supported by SAM which I think you have already implemented before, so will be a matter of triggering the same from the pipeline.

These capabilities are supported by most CI/CD tools, if you want to keep everything in AWS you could use CodePipeline which also supports GitHub integration. Nevertheless, Jenkins is perfectly fine and suitable for your use case as well.

Upvotes: 1

nikhil zadoo
nikhil zadoo

Reputation: 336

There are a lot of ways you can do it. So would depend eventually on how you decide to do it and what tools you are comfortable with. If you want to use native AWS tools, then Codepipeline is what might be useful. You can use CDK for that https://aws.amazon.com/blogs/developer/cdk-pipelines-continuous-delivery-for-aws-cdk-applications/

If you are not familiar with CDK and would prefer cloudformation, then this can get you started. https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-github-gitclone.html

Upvotes: 0

Related Questions