Handler.ps1 - AWS Code Sample

Handler.ps1

#Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.618.0'} Write-Host `## Environment variables Write-Host AWS_LAMBDA_FUNCTION_VERSION=$Env:AWS_LAMBDA_FUNCTION_VERSION Write-Host AWS_LAMBDA_LOG_GROUP_NAME=$Env:AWS_LAMBDA_LOG_GROUP_NAME Write-Host AWS_LAMBDA_LOG_STREAM_NAME=$Env:AWS_LAMBDA_LOG_STREAM_NAME Write-Host AWS_EXECUTION_ENV=$Env:AWS_EXECUTION_ENV Write-Host AWS_LAMBDA_FUNCTION_NAME=$Env:AWS_LAMBDA_FUNCTION_NAME Write-Host PATH=$Env:PATH Write-Host `## Event Write-Host (ConvertTo-Json -InputObject $LambdaInput -Compress -Depth 3) Write-Host `## Context Write-Host (ConvertTo-Json -InputObject $LambdaContext -Compress -Depth 3) # Process event foreach ($message in $LambdaInput.Records) { Write-Host $message.body } # Call Lambda API Get-LMAccountSetting | Select-Object -Property AccountUsage