Showing posts from June, 2020

Package and deploy a PowerShell Lambda function with custom modules

Recently I had the need to create a Lambda function with PowerShell 7. The function is to synchronize data between two REST APIs. It's fairly simple, but does need to use a custom made module. I spent quite bit time to find out how to deploy PowerShell Lambdas with custom modules. Thought might write a guide to help people want to do the same.    My script is fairly simple, it get a list of users from one API and then convert it to a XML format object and export into the target API. To reuse some of the code, The script requires AWS.Tools module as well as a custom made module, let's called it CAT. The CAT is module contians some functions that are invoked in by the main script. The inital lines of my main script looks like below: #Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion=''} #Requires -Modules @{ModuleName='AWS.Tools.SecretsManager';ModuleVersion=''} #Requires -Modules CAT  In addition to install the AWS.Tool