Using environment variables
To access environment variables in Go, use the Getenv
The following explains how to do this. Note that the function imports the fmt
package main import ( "fmt" "os" "github.com/aws/aws-lambda-go/lambda" ) func main() { fmt.Printf("%s is %s. years old\n", os.Getenv("NAME"), os.Getenv("AGE")) }
For a list of environment variables that are set by the Lambda runtime, see Defined runtime environment variables.