Let's pass an environment variable to our lambda
function.
We can do that by adding a prop to our helloLambda
function in the stacks file:
const helloLambda = new lambda.Function(this, "HelloLambda", {
environment: { isProduction: "absolutely not" }
});
Let's console.log
our variable:
console.log("isProduction?", process.env.isProduction);
Once you've deployed, you'll be able to see the log. Click on Test in the aws
console and checkout the Environment variables.