Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created November 24, 2019 12:04
Show Gist options
  • Save lantrix/d5e285d6c6ec30c3ae8d6b3bbeb37cf1 to your computer and use it in GitHub Desktop.
Save lantrix/d5e285d6c6ec30c3ae8d6b3bbeb37cf1 to your computer and use it in GitHub Desktop.
$lambda = 'test-ps-lambda'
Install-Module -Name AWS.Tools.Installer, AWSLambdaPSCore
Install-AWSToolsModule -Name Common, CloudWatchLogs, Lambda -Cleanup
New-AWSPowerShellLambda -Template Basic -ScriptName TestLambda -Directory testlambda
# Publish Lambda
$publishParams = @{
ScriptPath = ".\TestLambda.ps1"
Name = $lambda
Region = 'ap-southeast-2'
}
Publish-AWSPowerShellLambda @publishParams
$payload = @{
First = 'Joe'
Last = 'Blogs'
Dept = 'Ops'
} | ConvertTo-Json
Invoke-LMFunction -FunctionName $lambda -Payload $payload
$logs = Get-CWLFilteredLogEvent -LogGroupName "/aws/lambda/$lambda"
$log.Events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment