Jets AWS Lambda Package Type: Image or Zip

By default, Jets uses the image package type to deploy your app to AWS Lambda. Jets can deploy your project AWS Lambda with either Image or Zip package type, though.

Important: Jets only supports the image package type for Rails. If you try to deploy the zip format for Rails, the deploy will error. For Sinatra and other frameworks, you can use either image or zip formats. The AWS Lambda Runtime is more limited with the zip package type. Even common gems like nokogiri can have some issues.

Config

To configure the package type that Jets should deploy.

config/jets/deploy.rb

Jets.deploy.configure do
  config.package_type = "image"
end

Note: If you’re using Rails, Jets only supports the image format for Rails.

If you’re using the zip type because building a simple app that does even need a controller Lambda Function, you can also disable the creation of the controller with: config.lambda.controller.enable = false.

Image vs Zip Package Type

The Image format is a Docker Image. The Zip format is your app code packaged in a zip file. There are pros and cons to each format.

Advantages to Docker Image / Disadvantages to Zip

  • Use any Ruby version you want. You’re not limited to the AWS Lambda official Ruby runtimes.
  • Increase app size allowance. Up to 10GB images vs the zip 250MB limit.
  • A portable and more standard deployment format.

Disadvantages to Docker Image / Advantages to Zip

  • Cold starts are longer. They can add seconds.
  • You cannot use the Lambda Console editor. Note, you can’t use editor with the zip format either if the package is larger than 3GB.
  • You need a little more knowledge on Docker.

Important: Once a pacakge format is choosen, you cannot change it without first deleting the and redeploying.