https://github.com/hanazuki/cdk-lambda-ruby
CDK Construct Library for AWS Lambda in Ruby
https://github.com/hanazuki/cdk-lambda-ruby
aws-cdk aws-cdk-constructs aws-lambda aws-lambda-ruby ruby
Last synced: 5 months ago
JSON representation
CDK Construct Library for AWS Lambda in Ruby
- Host: GitHub
- URL: https://github.com/hanazuki/cdk-lambda-ruby
- Owner: hanazuki
- License: mit
- Created: 2020-12-04T18:48:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-24T06:28:01.000Z (about 1 year ago)
- Last Synced: 2024-04-25T07:21:45.539Z (about 1 year ago)
- Topics: aws-cdk, aws-cdk-constructs, aws-lambda, aws-lambda-ruby, ruby
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/cdk-lambda-ruby
- Size: 362 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# CDK Construct Library for AWS Lambda in Ruby
This library provides [AWS CDK](https://github.com/aws/aws-cdk) constructs for AWS Lambda functions written in [Ruby](https://www.ruby-lang.org/).
## Synopsis
```typescript
import * as cdk from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as lambdaRuby from 'cdk-lambda-ruby';
import { Construct } from 'constructs';export class ExampleStack extends cdk.Stack {
public constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);new lambdaRuby.RubyFunction(this, 'MyFunction', {
runtime: lambda.Runtime.RUBY_3_2,
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\_3\_2 at the moment).
If a file named "Gemfile" exists directly inside `sourceDirectory`, the dependency gems are bundled using [Bundler](https://bundler.io/). Bundling is performed inside a [Docker](https://www.docker.com/) 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](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionOptions.html).
## 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.