In a post yesterday, the AWS Developer team has announced that AWS Lambda support will be provided for PowerShell Core 6.0. Users can now execute PowerShell Scripts and functions in response to Lambda events.
Why should Developers look forward to this upgrade?
The AWS Tools for PowerShell will allow developers and administrators to manage their AWS services and resources in the PowerShell scripting environment. Users will be able to manage their AWS resources with the same PowerShell tools used to manage Windows, Linux, and MacOS environments. These tools will let them perform many of the same actions as available in the AWS SDK for .NET. What’s more is that these tools can be accessed from the command line for quick tasks. For example: controlling Amazon EC2 instances.
The PowerShell scripting language composes scripts to automate AWS service management.
With direct access to AWS services from PowerShell, management scripts can take advantage of everything that the AWS cloud has to offer. The AWS Tools for Windows PowerShell and AWS Tools for PowerShell Core are flexible in handling credentials including support for the AWS Identity and Access Management (IAM) infrastructure.
To understand how the support works, it is necessary to set up the appropriate development environment as shown below.
Set up the Development Environment
This can be done in a few simple steps-
1. Set up the correct version of PowerShell
2. Ensure Visual Studio Code is configured for PowerShell Core 6.0.
3. PowerShell Core is built on top of .NET Core hence install .NET Core 2.1 SDK
4. Head over to the PowerShell Gallery and install AWSLambdaPSCore module
The module provides users with following cmdlets to author and publish Powershell based Lambda functions-
Source: AWS Blog
You can head over to the AWS blog for detailed steps on how to use the Lambda support for PowerShell. The blog gives readers a simple example on how to execute a PowerShell script that ensures that the Remote Desktop (RDP) port is not left open on any of the EC2 security groups.