Skip to content

vaijab/flint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flint Logo

Flint

Fast iteration for Go Lambdas.

Important

Flint is designed for local development only. It should not be used for production deployments.

Flint replaces the slow "edit-deploy-test" loop with rapid updates. It watches your Go files, recompiles changes, and live reloads your Lambda's execution environment, bypassing deployment pipelines and cold starts.

How it Works

Flint acts as a custom runtime for your Lambda environment.

When you save a file, Flint cross-compiles your Go binary and uploads it to your S3 bucket. The Flint runtime running inside your Lambda detects the new binary, downloads it to the temporary directory, and hot-swaps the running process.

Installation

Binary

Download the latest binary for your OS from the Releases Page.

Go Install

go install github.com/vaijab/flint/cmd/flint@latest

Setup

1. Prepare Lambda

Flint requires a custom runtime to receive updates.

  1. Download the runtime zip for your architecture (amd64 or arm64) from the Releases Page.
  2. Upload the zip to your Lambda function.
  3. Set the runtime handler to bootstrap and add a FLINT_BUCKET environment variable pointing to a development S3 bucket.
# Example configuration
aws lambda update-function-code --function-name my-function --zip-file fileb://flint_runtime.zip

aws lambda update-function-configuration --function-name my-function \
  --handler bootstrap \
  --environment "Variables={FLINT_BUCKET=my-dev-bucket}"

2. Initialize Project

Run flint init in your project root. This scans for main packages and maps them to your AWS Lambdas.

flint init

3. Start Development

Run the watcher.

flint dev

Any change to a .go file will now trigger a rebuild and hot-swap the Lambda on next invocation.

Configuration

The flint.toml file stores your project mapping.

[project]
name = "my-service"

[[lambdas]]
name = "my-service-api-handler"  # AWS Lambda Function Name
path = "./cmd/api"               # Local path to main package

Infrastructure

Terraform Configuration

To use Flint with Terraform, configure your Lambda to use the custom runtime and set the FLINT_BUCKET environment variable.

resource "aws_lambda_function" "example" {
  function_name = "my-function"
  role          = aws_iam_role.lambda_exec.arn
  handler       = "bootstrap"
  runtime       = "provided.al2023" # or provided.al2

  # Upload the Flint runtime (downloaded from releases)
  filename         = "flint_runtime_linux_arm64.zip"
  source_code_hash = filebase64sha256("flint_runtime_linux_arm64.zip")

  environment {
    variables = {
      # The bucket where Flint will upload hot-swapped binaries
      FLINT_BUCKET = aws_s3_bucket.dev_bucket.id
    }
  }
}

FAQ

What happens if I change shared code? Flint detects changes in shared directories (like pkg/ or internal/) and automatically rebuilds all configured Lambdas.

My Lambda isn't updating? Check the CloudWatch logs for the bootstrap runtime. Ensure the FLINT_BUCKET variable is set and the Lambda execution role has s3:GetObject permissions.

About

Rapid Hot-Swapping for Go Lambdas

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages