How to Set Up a PowerShell Development Environment for AWS Lambda on Windows

50 VIEWS

·

To set up a PowerShell environment with AWS Lambda, you’re going to need to do three things:

• Install PowerShell Core v6 or higher
• Install .NET Core 2.1 (the SDK)
• Install the AWSLambdaPScore PowerShell module

Let’s see how to make it happen!

The first thing we have to do is install PowerShell Core v6 or higher. For this example, I’m going to be installing PowerShell 6.1 because it’s the latest version. You can either download the file with PowerShell or just go to the browser as you normally would. But since this is an article about PowerShell, I will be using PowerShell to do everything.

Once downloading is complete, use the Invoke-WebRequest command. Then, pass in the direct filename of PowerShell 6.1, the 64-bit edition. Finally, save that to your hard drive.

Once that’s done, we can install it. Again, we can just go to the installer manually and run it that way, but let’s stay in PowerShell just to make it easier. To do that, for this example, I’m just going to use Start-Process, run msiexec.exe, pass it some arguments — the /i, the file path and /qb to make it quiet, and to show the progress as it goes through.

After running the installer, if you didn’t receive any errors, PowerShell Core should be installed.

Next up, let’s install .NET Core 2.1, the SDK.

Microsoft provides a really nice PowerShell script to automate the download and installation of the SDK, so let’s use that.

First, download Microsoft’s dotnet-install PowerShell script using Invoke-WebRequest. The download should be quick.

Next, we’ll run it by passing a channel of LTS, which the PowerShell script has created with a channel parameter. This essentially is going to provide the latest .NET Core SDK version (long-term-supported).

It should have downloaded the package and extracted the Zip file.

Now the only thing we have left to do is to install the AWSLambdaPScore module. So let’s first bring up PowerShell Core and run Install-Module to install the AWSLambdaPSCore module.

It will prompt you about an untrusted repository. That’s completely normal; just hit Y for Yes.

Once it finishes with the install, let’s go ahead and make sure it’s installed by running Get-Module.

Get-Module -Name AWSLambdaPSCore -ListAvailable

It looks like the latest version is 1.1.

We have now installed PowerShell Core v6, installed the .NET SDK 2.1, and installed the AWSLambdaPScore PowerShell module. That’s everything it takes to get a development environment set up for running PowerShell in AWS Lambda!

Do you think you can beat this Sweet post?

If so, you may have what it takes to become a Sweetcode contributor... Learn More.

Adam Bertram is a 20-year veteran of IT and experienced online business professional. He’s an entrepreneur, IT influencer, Microsoft MVP, blogger, trainer and content marketing writer for multiple technology companies. Adam is also the founder of the popular IT career development platform TechSnips. Catch up on Adam’s articles at adamtheautomator.com, connect on LinkedIn, or follow him on Twitter at @adbertram or the TechSnips Twitter account at @techsnips_io.


Discussion

Click on a tab to select how you'd like to leave your comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Menu