How To Create An AWS Lambda PowerShell Function the Easy Way — Using Docker


I’ve been working with PowerShell since its beginning and haven’t looked back since. Last year, while working on an serverless project for work, I decided to try Lambda on my own and deploy some PowerShell code to AWS to see how it works.

Fast forward to now…I started working more with AWS on my own while studying for some certs. I jumped back into Lambda and was reminded of how tedious it was to setup my environment for publishing my PowerShell code to AWS. Unfortunately, I didn’t take any notes last time and wanted to ensure I next time around I could just focus on the code. That is where Docker comes in to save the day and our story begins — I created a Docker container with all the dependencies required to publish your PowerShell code to AWS in as little as 5 minutes with a few scripts included to help streamline the process.

So, jump on in and give it a try.

See It In Action


  • You have an AWS Account and access to you “Access Key Id” and “Secret Access key”
  • You have access to Docker or Docker Desktop
  • You have some Docker know how

If you are lacking in either of these areas head on over to the Docker website and learn how to Get Started!

So, How Easy Is It To Publish My Code?

Really easy, check out the steps below…

The create-project script will ask a few questions during setup to assist with

  • Setting up the PowerShell Lambda Project
  • Creating a script to edit your PowerShell code
  • Creating a script to publish your PowerShell
  • Adding your AWS credentials via the ‘aws configure’ cli

This is the same as running

If you don’t have any code readily available feel free to append the code below to <projectname>.ps1.

That’s it — the container abstracts a lot of the complexity of getting started. Hopefully, you’ll give it a try.

Project Notes

  • The lambda-powershell-project-builder container has all the dependencies required to get started quickly with PowerShell on AWS Lambda
  • The create-project.ps1 script runs the Publish-AWSPowerShellLambda command with the values collected during the script execution and creates the edit and publish scripts on the fly based on your answers. Finally, it launches the ‘aws configure’ cli command for so you can enter your aws “Access Key Id” and “Secret Access key” which is required for publishing your Lambda application.
  • The publish-<project>.ps1 script run the Publish-AWSPowerShellLambda script with some sensible defaults

Project Links

Additional Links



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rick Jacobo

Rick Jacobo

AWS Certified Solutions Architect Associate