Thursday, December 15, 2016

Using environment variables with AWS Lambda & C#

Environment variables are a great new feature that has been added to Lambda functions in AWS. But how do you access them in a C# lambda function? Digging through the context parameter I thought I'd found it @: ILambdaContext.ClientContext.Environment

But it turns out, they are available through the static class System.Environment, e.g:

var variableValue = Environment.GetEnvironmentVariable("nameOfVariable");

....

edit: wow just realised it's been almost two years since my last post.... time to bring this thing back to life :)