1

I am looking to develop a work flow as follows

  1. The developers commit their code to github
  2. As soon as the Master branch changes (merge), through web hooks, it triggers a AWS CodePipeline where Build happens as a second stage using CodeBuild
  3. Ideally the work flow exists already for CodeDeploy or ECS where the built artifact replaces the task definition in ECS and updates the service. But I am looking for a lambda deployment.

It means, the built artifact or the zip file that gets uploaded to S3 bucket by CodeBuild should trigger a lambda function and also the lambda function code should be updated from the artifacts of CodeBuild.

Now I know one of the triggers for Lambda is S3 but it only triggers a already defined lambda function to execute but not update the function and execute it.

From the console, I do not think there is a way to do this directly. As complicated as it sounds, I am hoping there is a way.

Any pointers in that direction would be great.

1 Answer 1

3

I am using AWS CloudFormation to do my AWS Lambda deployment. In this case my AWS CodePipeline got 3 Stages (for simplicity):

  1. Stage "Source": GitHub
  2. Stage "Build": AWS CodeBuild
  3. Stage "Deploy": AWS CloudFormation

Inside the Build Stage i am doing the typical building procedure npm install, npm test, etc.

Important here: in the end of my build i am using aws cloudformation package which puts my code together, uploads it automatically to S3 and generates a final AWS CloudFormation template which i am then use in the 3. Stage "Deploy".

Sign up to request clarification or add additional context in comments.

3 Comments

Based on your idea I built up a SAM template but the exact same steps. Thank you
@SriharshaPolimetla, can you please share the SAM template that you built
@Balakrishna github.com/S-Polimetla/lambda-dynamodb-api-sam Maybe this repo helps you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.