Badal Gupta
Badal Gupta

Reputation: 1

Creating lambda Function to Trigger Codebuild Project using Nodejs with help api request

how can I write node.js lambda function to call code build function to auto rebuild the project without any manual operations

Upvotes: 0

Views: 880

Answers (1)

Hatim
Hatim

Reputation: 1172

For the lambda You can use aws sdk to do that, example :

const AWS = require("aws-sdk");
const codebuildSDK = new AWS.CodeBuild();
const build = {
   projectName: "MyProjectBuild"
};
result = await codebuildSDK.startBuild(params).promise();

but if you want, you can directly use Cloud watch event to run directly a Codebuild as a target https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatch-Events-tutorial-codebuild.html

Upvotes: 3

Related Questions