Skip to content

rinsed-org/cdk-lambda-ruby

 
 

Repository files navigation

CDK Construct Library for AWS Lambda in Ruby

This library provides CDK constructs for AWS Lambda functions written in Ruby.

Synopsis

import * as cdk from '@aws-cdk/core';
import * as lambda from '@aws-cdk/aws-lambda';
import * as lambdaRuby from 'cdk-lambda-ruby';

export class ExampleStack extends cdk.Stack {
  public constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new lambdaRuby.RubyFunction(this, 'MyFunction', {
      runtime: lambda.Runtime.RUBY_2_7,
      sourceDirectory: 'function',
      handler: 'main.handler',
      bundlerConfig: {  // optional
        without: 'development:test',  // optional, default: 'development:test'
        build: {  // optional
          'some-gem': '--some-build-option',
        },
      },
    });
  }
}

Description

RubyFunction deploys the sourceDirectory as a Lambda function written in Ruby. runtime is expected to be a Ruby-family Lambda Runtime (i.e., RUBY_2_5 or RUBY_2_7 at the moment).

If a file named "Gemfile" exists directly inside sourceDirectory, the dependency gems are bundled using Bundler. Bundling is performed inside a Docker container using the Lambda builder images privided by AWS. The bundlerConfig prop may have the without field to specify a colon-separated list of gem groups to skip installation.

RubyFunction also accepts common FunctionOptions.

Caching

The library caches downloaded gems, compiled extensions, and installation trees under "cdk.out/.cache" to optimize synthesis speed. Try delete these files if something unexpected happens.

About

CDK Construct Library for AWS Lambda in Ruby

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • TypeScript 91.1%
  • Shell 6.2%
  • Ruby 2.7%