Lambda Function that runs CodeBuild after something is uploaded to S3?

Is it possible, using Serverless, to create a lambda function that runs CodeBuild after a .zip file is uploaded to S3?
I want to run code evaluation for different people using NodeJS. So what I want is, after someone sends their Zipped code, CodeBuild runs that code, build it, and runs tests.
I got all steps covered, but this one. I don’t know how to make a lambda function to execute a CodeBuild script. Is it possible?

Thanks.

Almost certainly.

You can trigger a lambda when a file is uploaded to S3 (see https://serverless.com/framework/docs/providers/aws/events/s3/)

You can use the AWS SDK to interact with CodeBuild to create projects and start builds (see http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CodeBuild.html).

2 Likes