https://github.com/borgoat/lambda-builders-go
Call aws-lambda-builders from Go via JSON-RPC
https://github.com/borgoat/lambda-builders-go
aws lambda serverless
Last synced: 5 months ago
JSON representation
Call aws-lambda-builders from Go via JSON-RPC
- Host: GitHub
- URL: https://github.com/borgoat/lambda-builders-go
- Owner: borgoat
- License: apache-2.0
- Created: 2021-04-11T10:26:57.000Z (over 4 years ago)
- Default Branch: development
- Last Pushed: 2021-04-13T14:21:34.000Z (over 4 years ago)
- Last Synced: 2025-01-05T12:42:22.827Z (6 months ago)
- Topics: aws, lambda, serverless
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lambda Builders Go
[](https://pkg.go.dev/github.com/borgoat/lambda-builders-go)
[](https://goreportcard.com/report/github.com/borgoat/lambda-builders-go)
[](https://github.com/borgoat/lambda-builders-go/blob/development/LICENSE)Go wrapper for [AWS Lambda Builders](https://github.com/aws/aws-lambda-builders),
using its JSON-RPC API.> Lambda Builders is a Python library to compile, build and package AWS Lambda functions for several runtimes & frameworks.
## Getting Started
First, the lambda-builders executable is required:
```shell
$ pip install --user aws-lambda-builders
```Now, download this module:
```shell
$ go get -u github.com/borgoat/lambda-builders-go
```Here is an example how to use this library:
```go
package mainimport lambdabuilders "github.com/borgoat/lambda-builders-go"
func main() {
// Client executes lambda-builders and uses JSON-RPC to communicate with it
client, err := lambdabuilders.NewClient()
if err != nil {
panic(err)
}// Here we create a new builder for a Lambda written in Go, using Go Modules
// Other workflows may be found in the aws-lambda-builders Python library:
// https://github.com/aws/aws-lambda-builders/tree/develop/aws_lambda_builders/workflows
b, err := client.NewBuilder("go", "modules", "")
if err != nil {
panic(err)
}// Finally we actually call LambdaBuilders.build
// Check out how to configure it from the Python library:
// https://github.com/aws/aws-lambda-builders/blob/165f92f35753d87e4abe1115fd2399826b371e1f/aws_lambda_builders/builder.py#L56-L67
err = b.Build(
"/path/to/source",
"/path/to/compile",
"/path/to/scratchdir",
"/path/to/source/go.mod",
lambdabuilders.WithRuntime("go1.x"),
lambdabuilders.WithOptions(map[string]interface{}{
"artifact_executable_name": "my-handler",
}),
)
if err != nil {
panic(err)
}
}
```