Skip to content

Instantly share code, notes, and snippets.

@potix2
Created January 10, 2019 06:13
Show Gist options
  • Save potix2/3f8003d420462ae3293c439c7619effe to your computer and use it in GitHub Desktop.
Save potix2/3f8003d420462ae3293c439c7619effe to your computer and use it in GitHub Desktop.
GetEncryptedSystemParameterFromLambda
package main
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/aws/aws-lambda-go/lambda"
)
func handler(ctx context.Context) (string, error) {
sess := session.Must(session.NewSession())
client := ssm.New(sess)
output, err := client.GetParameter(&ssm.GetParameterInput{Name: aws.String("test-enc-param"), WithDecryption: aws.Bool(true)})
if err != nil {
return "", err
}
return fmt.Sprintf("Hello, %v", *output.Parameter.Value), nil
}
func main() {
lambda.Start(handler)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment