Skip to main content

AWS PowerShell Lambda Build Environment for Docker

If you’re deploying an AWS PowerShell Lambda (which is PowerShell Core 6.0) in a build pipeline, you’ll likely come across the fact that the older PowerShell docker images don’t have Dotnet Core installed.

The .NET Core 3.0 .NET Core 3.0 SDK Docker images now contain PowerShell Core, but since AWS still uses .NET Core 2.1 which is in Long Term Support, you’re out of luck.

Therefore if you’re deploying your lambda from your CI pipeline using docker, then you need a build environment which has:

  • PowerShell Core 6
  • .NET Core 2.1
  • AWS Tools for PowerShell

You’ve come to the right place. Here is a DockerFile you can use to build your Lambda deployment environment. Make sure you choose the AWS PowerShell Tools module you need in the last line:

An example of how you can build and use this image in a pipeline is below. I use Buildkite, so YMMV: