- Notifications
You must be signed in to change notification settings - Fork20
This new PowerShell custom runtime for AWS Lambda makes it even easier to run Lambda functions written in PowerShell to process events.
License
awslabs/aws-lambda-powershell-runtime
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ThisPowerShell custom runtime forAWS Lambda enables running Lambda functions written in PowerShell to process events.
Your code runs in an Amazon Linux environment that includes AWS credentials from anAWS Identity and Access Management (IAM) role that you manage.
Lambda has supported running PowerShell since 2018. However, the existing solution uses the .NET Core runtimeimplementation for PowerShell. It uses the additionalAWSLambdaPSCore modules for deployment and publishing, which require compiling the PowerShell code into C# binaries to run on .NET. This adds additional steps to the development process.
This runtime uses Lambda'scustom runtime functionality based on theprovided.al2023
runtime.
Native PowerShell. This runtime uses native PowerShell.
- The function runtime environment matches a standard PowerShell session, which simplifies the development and testing process.
- No compilation step required and no hosting on the .NET runtime.
- Allows additional functionality, such as
Add-Type
to provide richer context information.
Code visibility. You can view and edit PowerShell code within the Lambda console's built-incode editor when using .zip archive functions (not container images). You can embed PowerShell code within anAWS CloudFormation template, or other infrastructure as code tools.
Output. 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. With the previous .NET runtime implementation, your function returns only the last output from the PowerShell pipeline. Unhandled exceptions are caught by the runtime, then they are logged to the log stream and a error result is returned to the caller.
- PowerShell 7.0 or later for development and testing
- Download from:https://github.com/PowerShell/PowerShell/releases
- Required for development tools and test suite
The runtime includes unit tests and integration tests:
- Unit Tests: Automated tests covering runtime functions and build processes
- Integration Tests: Manual tests with real AWS Lambda functions for end-to-end validation
Seepowershell-runtime/tests/README.md for testing documentation and commands.
You can build the custom runtime using AWS SAM or other infrastructure-as-code tools. Deploy the exampledemo-runtime-layer-function to explore how the runtime works.
Seepowershell-runtime/README.md for detailed deployment instructions.
- powershell-runtime/ - Custom runtime implementation and deployment methods
- powershell-modules/ - Pre-built PowerShell modules (AWS Tools, VMware PowerCLI)
- examples/ - Demo applications showing runtime functionality
Example | Description |
---|---|
demo-runtime-layer-function | Complete runtime layer with AWS Tools and multiple handler options |
demo-s3-lambda-eventbridge | Event-driven application processing S3 files with EventBridge |
demo-container-image-all-aws-sdk | Container image deployment with full AWS SDK |
demo-container-images-shared | Shared container layers for multiple functions |
See thePowerShell-runtime documentation for detailed information on runtime variables, handler options, context objects, module support, logging, and error handling.
This custom runtime builds on the work ofNorm Johanson,Kevin Marquette,Andrew Pearce, Afroz Mohammed, and Jonathan Nunn.
SeeCONTRIBUTING for more information.
This project is licensed under the Apache-2.0 License.
About
This new PowerShell custom runtime for AWS Lambda makes it even easier to run Lambda functions written in PowerShell to process events.
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.