AWS Introduces PowerShell Custom Runtime for Lambda
AWS recently announced a new PowerShell custom runtime for AWS Lambda to run Lambda functions written in PowerShell. With the new runtime developers can write native PowerShell code in Lambda without having to compile it, simplifying deployment and testing.
Julian Wood, serverless developer advocate at AWS, explains the benefits:
The new custom runtime for PowerShell uses native PowerShell, instead of compiling PowerShell and hosting it on the .NET runtime. Using native PowerShell means the function runtime environment matches a standard PowerShell session, which simplifies the development and testing process (…) This custom runtime returns everything placed on the pipeline as the function output, including the output of Write-Output. This gives you more control over the function output, error messages, and logging.
While Lambda has supported PowerShell since 2018, the previous solution required the .NET Core runtime implementation for PowerShell and a function returned only the last output from the PowerShell pipeline. Justin Grote, Microsoft MVP and Powershell evangelist, tweets:
AWS Lambda finally has a PowerShell runtime that isn’t “Hey build a C# app that’s a PowerShell host, that’s how we support PowerShell”. Great work!
Building Lambda functions with PowerShell currently supports .NET 6 and .NET Core 3.1. The runtime defines two main variables made available to the Lambda function: $LambdaInput, a PSObject that contains the input event data, and $LambdaContext, an object that provides methods and properties with information about the invocation and runtime environment.
Comments are closed.