AWS Developer Blog

PowerShell 7 support with AWS Lambda

Recently we released our .NET Core 3.1 AWS Lambda runtime. With our previous .NET Core 2.1 Lambda runtime we released the AWSLambdaPSCore PowerShell module that made it easy to deploy PowerShell scripts to Lambda using PowerShell 6 and the .NET Core 2.1 Lambda Runtime.

Now we have released version 2.0.0 of the PowerShell module AWSLambdaPSCore. This new version deploys PowerShell scripts to Lambda using PowerShell 7 and the new .NET Core 3.1 Lambda Runtime.

For a tutorial on how to use AWSLambdaPSCore to deploy PowerShell scripts see this previous blog post introducing the AWSLambdaPSCore module.

AWS Tools for PowerShell 4.0.0

Since we released the original version of AWSLambdaPSCore, AWS Tools for PowerShell version 4 has been released. This major update contains many new features like support for mandatory parameters, easy to use Stream parameters, and a new -Select parameter to control the output of cmdlets. You can read more about this release here.

The biggest change in version 4 of the AWS Tools for PowerShell was a refactor to a more modular version, with a separate PowerShell module for each AWS service, as well as a shared module named AWS.Tools.Common. This means your scripts can import modules for only the services they need. When you write your PowerShell scripts to deploy to Lambda I recommend using the modular variant as opposed to the much larger AWSPowerShell.NetCore module. Your deployment bundle will be much smaller and it can be faster to import the smaller service modules, as opposed to the large all-encompassing AWSPowerShell.NetCore module.

When the deployment bundle is created by AWSLambdaPSCore the script is inspected for #Requires statements and the requested modules are included in the deployment bundle. Be sure to have a #Requires statement for AWS.Tools.Common module whenever using the modular AWS.Tools modules. Here is an example of adding the module for Amazon S3 to your PowerShell script.

#Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion=''}
#Requires -Modules @{ModuleName='AWS.Tools.S3';ModuleVersion=''}


PowerShell 7 is an exciting release to the PowerShell community and we are excited to see our AWS PowerShell community take advantage of PowerShell 7 on AWS Lambda.

Our Lambda tooling for PowerShell is open source and you can check it out here. For any feedback for our Lambda PowerShell tooling let us know there.