Created
January 10, 2019 06:13
-
-
Save potix2/3f8003d420462ae3293c439c7619effe to your computer and use it in GitHub Desktop.
GetEncryptedSystemParameterFromLambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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