Sign inSign up

uguraslan/minio-lambda-bridge

By uguraslan

Updated about 3 years ago

Simulate S3 event workflows for AWS Lambda using Minio events locally in dev environments

Image
0

1.3K

uguraslan/minio-lambda-bridge repository overview

Minio Lambda Bridge

The Minio Lambda Bridge is a Docker image that aims to seamlessly connect Minio, a self-hosted S3-compatible storage system, with local JavaScript-based AWS Lambda functions. This tool provides a local development environment for simulating AWS Lambda triggers using Minio events, enabling you to test and refine your event-driven workflows before deployment.

Features:

  • Emulate AWS Lambda triggers using Minio events locally.
  • Easily configure event mappings between Minio and local Lambda functions.
  • Lightweight and customizable solution for event-driven development with Minio and AWS Lambda.
  • Compatible with standard AWS Lambda event formats for easy migration to production.

How It Works:

The Minio Lambda Bridge provides a Docker-based service that listens for Minio events and triggers local JavaScript-based AWS Lambda functions upon event occurrences. This project bridges the gap between Minio's event capabilities and local development environments.

Getting Started:

  • Add a service to your Docker Compose file by using the public image uguraslan/minio-lambda-bridge:latest.
  • Define required environment variables for the service. List of environment variables can be found below.
  • Add environment variables that your Lambda function requires (db connection strings, etc.). These variables will be passed to your Lambda function as environment variables.
  • Add a volume to the service to mount your Lambda function code. The Lambda function code must be located under /usr/src/app in the container.
Example Docker Compose File:

If you are using Docker Compose, you can use the following example as a starting point. This example assumes that you have a local Lambda function located under ./lambda directory. You can change the EVENT_LAMBDA_FUNCTION_PATH environment variable to point to your Lambda function code. But never point your lambda function directly to /usr/src/app directory.

version: "3"
services:
    minio-lambda-bridge:
        image: uguraslan/minio-lambda-bridge:latest
        environment:
            MINIO_HOST: http://minio
            MINIO_PORT: 9000
            MINIO_ACCESS_KEY: minio
            MINIO_SECRET_KEY: minio123
            MINIO_NOTIFICATIONS_BUCKET: my-bucket
            MINIO_NOTIFICATIONS_PREFIX: my-prefix
            MINIO_NOTIFICATIONS_SUFFIX: my-suffix
            MINIO_NOTIFICATIONS_EVENTS: s3:ObjectCreated:*, s3:ObjectRemoved:*
            EVENT_LAMBDA_FUNCTION_PATH: lambda/index.js
            EVENT_LAMBDA_HANDLER: handler
        volumes:
            - ./lambda:/usr/src/app/lambda
        depends_on:
            - minio
      minio:
        image: minio/minio
        restart: always
        command: server /data --console-address ":9001"
        volumes:
            - minio-data:/data
        ports:
            - "9000:9000"
            - "9001:9001"
        environment:
            MINIO_ROOT_USER: myAccessKey
            MINIO_ROOT_PASSWORD: mySecretKey
volumes:
    minio-data:
Environment Variables:
Variable NameDescriptionDefault Value
MINIO_HOSTMinio server hosthttp://minio
MINIO_PORTMinio server port9000
MINIO_ACCESS_KEYMinio server access key-
MINIO_SECRET_KEYMinio server secret key-
MINIO_NOTIFICATIONS_BUCKETMinio bucket name to listen for eventsall buckets
MINIO_NOTIFICATIONS_PREFIXMinio object prefix to listen for eventsall objects
MINIO_NOTIFICATIONS_SUFFIXMinio object suffix to listen for eventsall objects
MINIO_NOTIFICATIONS_EVENTSMinio events to listen fors3:BucketCreated:*, s3:BucketRemoved:*, s3:ObjectCreated:*, s3:ObjectRemoved:*, s3:ObjectAccessed:*
EVENT_LAMBDA_FUNCTION_PATHRelative path (under /usr/src/app) to local Lambda function-
EVENT_LAMBDA_HANDLERLambda function handler name-

Tag summary

Content type

Image

Digest

sha256:dfd0c0bb6

Size

369.4 MB

Last updated

about 3 years ago

docker pull uguraslan/minio-lambda-bridge