techthoughts2
12/1/2018 - 6:17 AM

PowerShell Lambda

Some basic code snips for PowerShell Lambda Stuff

#Download the .NET Core 2.1 SDK from https://www.microsoft.com/net/download
Install-Module AWSPowerShell.NetCore
Install-Module AWSLambdaPSCore

Import-Module AWSPowerShell.NetCore
Import-Module AWSLambdaPSCore

Get-Command -Module AWSLambdaPSCore

New-Item PSLambda -ItemType Directory
New-AWSPowerShellLambda -Template Basic -ScriptName ScriptTest
#Configuring script to use installed version 3.3.390.0 of AWSPowerShell.NetCore.
#Created new AWS Lambda PowerShell script ScriptTest.ps1 from template Basic at C:\directory\PSLambda\ScriptTest

Publish-AWSPowerShellLambda -Name ScriptTest -ScriptPath .\ScriptTest.ps1

(Invoke-LMFunction -FunctionName ScriptTest -Payload '{"foo":"bar"}').payload | ConvertTo-String

Publish-AWSPowerShellLambda -Name ScriptTest -ScriptPath .\ScriptTest.ps1 -PowerShellFunctionHandler Send-TestFunction