Ruby Lambda Template logo

Ruby Lambda Template

by delian7

This repository provides a template for building AWS Lambda functions using Ruby. It allows you to customize and handle HTTP requests or other tasks in a serverless environment.

View on GitHub

Last updated: N/A

Ruby Lambda Template

This repository serves as a template for building AWS Lambda functions using Ruby. Customize it as needed to handle HTTP requests or other tasks in a serverless environment.

Prerequisites

  • Ruby
  • Bundler
  • AWS CLI

Setup

  1. Clone the repository:

    git clone https://github.com/delian7/ruby_lambda_template
    cd ruby_lambda_template
    
  2. Install the dependencies:

    bundle install
    
  3. Configure environment variables (if needed):

    If you require environment configuration, copy the .env.sample file to .env and update it accordingly:

    cp .env.sample .env
    

Running Tests

To run the tests using RSpec:

bundle exec rspec

Deploying to AWS Lambda

  1. Configure AWS CLI:

    aws configure
    
  2. Package the application:

    zip -r lambda_function.zip .
    
  3. Update the Lambda function code:

    aws lambda update-function-code --function-name your_lambda_function_name \
    --zip-file fileb://lambda_function.zip
    

Alternatively, you can combine packaging and updating:

zip -r lambda_function.zip . && aws lambda update-function-code --function-name your_lambda_function_name \
--zip-file fileb://lambda_function.zip

Usage

This repository provides a starting point for AWS Lambda functions written in Ruby. Modify the Lambda function code and tests as needed for your specific use case.