Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created October 21, 2019 06:09
Show Gist options
  • Save lantrix/a173294e94f8ea905910c5ed0f00a4f9 to your computer and use it in GitHub Desktop.
Save lantrix/a173294e94f8ea905910c5ed0f00a4f9 to your computer and use it in GitHub Desktop.
Start Deving a new PowerShell DotNet Core lambda

Install

  • Install Powershell 6.x on Mac brew cask install powershell

  • Install the .NET Core 2.1 SDK (not runtime)

  • Install the AWSLambdaPSCore module. Install-Module AWSLambdaPSCore -Scope CurrentUser

Setup

  • Create new project New-AWSPowerShellLambda -ScriptName blah -Template Basic

AWS Tools (Beta)

Move to AWS Tools for PowerShell in AWS Lambda, you can now switch to the new AWS.Tools modules. They will help lower cold start time and memory usage.

You will need to change the #Requires statement from AWSPowerShell.NetCore to the AWS.Tools module you wish to use (e.g. AWS.Tools.S3).

You will also need to add an extra #Requires statement to use AWS.Tools.Common. AWS will remove this requirement in the future by supporting automatic identification of the module dependencies.

Change the line:

#Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.335.0'}

to

#Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion='3.3.604.0'}
#Requires -Modules @{ModuleName='AWS.Tools.S3';ModuleVersion='3.3.604.0'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment