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 gets 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 call it CAT. The CAT is a module contains some functions that are invoked by the main script. The inital lines of my main script look 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.Tools