Skip to content

teamkeel/sst-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SST Resource Binding for Go

SST lets you bind resources to Lambda functions which both adds the right permissions and also injects environment variables containing information about that resource, for example it's ARN.

This package is a port of the node package for using resource bindng in Lambda functions written in Go.

Simple Example

If you have an S3 bucket that is bound to a function:

// Create an S3 bucket
const bucket = new Bucket(stack, "MyFiles");

new Function(stack, "MyFunction", {
  handler: "main.go",
  // Bind to function
  bind: [bucket],
});

Then in your Go function you can access the bucket name by doing the following:

package main

import (
    "fmt"

    "github.com/aws/aws-lambda-go/lambda"
    "github.com/teamkeel/sst-go"
)

func main() {
    lambda.Start(handler)
}

func handler(ctx context.Context) error {
    // load the resource
    bucket, err := sst.Bucket("MyFiles")
    if err != nil {
      return err
    }

    bucket.BucketName // name of the bucket
}

Supported Bindings

  • Secret (including fallback values)
  • Parameter
  • Function
  • EventBus
  • Topic
  • Queue
  • RDS
  • Table

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages