This example shows to deploy a Jets application with codebuild to AWS Lambda.

Here’s the project DSL.


  JETS_ENV: Cody.env,
  JETS_TOKEN: ssm("/jets-cody-demo/#{Cody.env}/CODY_JETS_TOKEN"),

The .cody/project.rb uses a Docker image that has Ruby, Node, and Yarn already installed. If you prefer to use another image, update the linux_image setting, and update your buildspec.yml accordingly. For example, you may need to install the necessary packages.

Here’s the buildspec:


# Build Specification Reference for CodeBuild:

version: 0.2

      - yum install -y rsync zip
      - curl -s -o- -L | bash
      nodejs: latest
      ruby: 2.7
      - bash -c 'if [ "$CODEBUILD_BUILD_SUCCEEDING" == "0" ]; then exit 1; fi'
      - ruby --version
      - yarn install --check-files
      - bundle
      - export JETS_AGREE=yes
      - bundle exec jets configure $JETS_TOKEN
      - bundle exec jets deploy $JETS_ENV

And here are the IAM permissions required as described in Jets Minimal IAM Deploy Policy.



Here’s also Github repo with CodeBuild examples with Jets: tongueroo/jets-cody-demo. The example on the master branch is a similar simple approach with 1 CodeBuild project.

You may be interested in the separate-unit-and-deploy branch. The example shows how to set up 2 separate CodeBuild projects. Some advantages:

  • The projects are decoupled and you can run them separately.
  • Only the deploy project requires IAM access to create the AWS resources.

Create CodeBuild Project

To create the CodeBuild project via CloudFormation run:

cody deploy demo

This creates the CodeBuild project as well as the necessary IAM role.

Start Build

To start a build:

cody start demo

You can also start a build with a specific branch. Remember to git push your branch.

cody start demo -b mybranch

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub, and contributions are encouraged and welcomed. We love pull requests from you!