{"id":14296,"date":"2020-06-16T13:20:11","date_gmt":"2020-06-16T11:20:11","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/"},"modified":"2020-06-16T13:20:11","modified_gmt":"2020-06-16T11:20:11","slug":"publishing-a-powershell-script-to-aws-lambda","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/","title":{"rendered":"Publishing a PowerShell script to AWS Lambda"},"content":{"rendered":"<p>I&#8217;ve done some <a href=\"https:\/\/aws.amazon.com\/lambda\/\" target=\"_blank\" rel=\"noopener noreferrer\">Lambda<\/a> functions with Python in the past and it was quite easy to publish that to Lambda (by just uploading a zip file with all my code and dependencies). You might ask yourself why I want to do that with PowerShell but the reason is quite simple: There was a requirement at a customer to automatically collect all the <a href=\"https:\/\/www.catalog.update.microsoft.com\/Search.aspx?q=kb\" target=\"_blank\" rel=\"noopener noreferrer\">KBs<\/a> that are installed in the <a href=\"http:\/\/aws.com\/workspaces\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Windows WorkSpaces<\/a> for compliance reasons. Doing that for <a href=\"https:\/\/aws.amazon.com\/ec2\/\" target=\"_blank\" rel=\"noopener noreferrer\">EC2<\/a> or on-prem instances is quite easy using <a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/lambda-python.html\" target=\"_blank\" rel=\"noopener noreferrer\">Lambda for Python<\/a> against <a href=\"https:\/\/aws.amazon.com\/systems-manager\/\" target=\"_blank\" rel=\"noopener noreferrer\">SSM<\/a> when you are using <a href=\"https:\/\/www.dbi-services.com\/blog\/avoiding-patching-madness-by-using-aws-ssm\/\" target=\"_blank\" rel=\"noopener noreferrer\">SSM for patching<\/a>, but if you want to list the installed KBs of your deployed AWS WorkSpaces you need a different way of doing that. After discussing that with AWS Support it turned out that the easiest solution for this is to use the <a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/get-hotfix?view=powershell-7\" target=\"_blank\" rel=\"noopener noreferrer\">PowerShell Get-HotFix<\/a> module remotely against the AWS WorkSpaces. Easy, I thought, when I can deploy Python code in Lambda I can easily do this for PowerShell as well. But this is definitely not true as the process is quite different. So, here we go &#8230;<\/p>\n<p><!--more--><\/p>\n<p>The first bit you need to prepare is a <a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/powershell-devenv.html\" target=\"_blank\" rel=\"noopener noreferrer\">PowerShell development environment for AWS<\/a>. As I am running Linux (<a href=\"https:\/\/neon.kde.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">KDE Neon<\/a>, if you want to know exactly), and PowerShell is available on Linux since quite some time, I&#8217;ll be showing how to do that on Linux (the process is more or less the same for Windows though).<br \/>\nObviously PowerShell needs to be installed and this is <a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/scripting\/install\/installing-powershell-core-on-linux?view=powershell-7\" target=\"_blank\" rel=\"noopener noreferrer\">documented by Microsoft<\/a> quite well, no need to further explain this. Basically it is matter of:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ wget -q https:\/\/packages.microsoft.com\/config\/ubuntu\/18.04\/packages-microsoft-prod.deb\n$ sudo dpkg -i packages-microsoft-prod.deb\n$ sudo apt-get update\n$ sudo add-apt-repository universe\n$ sudo apt-get install -y powershell\n<\/pre>\n<p>&#8230; and that&#8217;s it (take care to follow the steps for your Linux distribution). Once that is done PowerShell can be started:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ pwsh\nPowerShell 7.0.2\nCopyright (c) Microsoft Corporation. All rights reserved.\n\nhttps:\/\/aka.ms\/powershell\nType 'help' to get help.\n\nPS \/home\/dwe&gt; \n\n<\/pre>\n<p>The first additional module you&#8217;ll need is <a href=\"https:\/\/www.powershellgallery.com\/packages\/AWSLambdaPSCore\/2.0.0.0\" target=\"_blank\" rel=\"noopener noreferrer\">AWSLambdaPSCore<\/a>:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nPS \/home\/dwe&gt; Install-Module AWSLambdaPSCore -Scope CurrentUser\n\nUntrusted repository\nYou are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the \nSet-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?\n[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is \"N\"): Y\n<\/pre>\n<p>Usually you want to work with other AWS Services in your Lambda code so it is recommended to install the <a href=\"https:\/\/www.powershellgallery.com\/packages\/AWS.Tools.Installer\/1.0.1.0\" target=\"_blank\" rel=\"noopener noreferrer\">AWS.Tools.Installer<\/a> module as it provides a convenient way for installing the various tools required for working with the various AWS services. In addition the <a href=\"https:\/\/www.powershellgallery.com\/packages\/AWSPowerShell.NetCore\/4.0.5.0\" target=\"_blank\" rel=\"noopener noreferrer\">AWSPowerShell.NetCore<\/a> module is required:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nPS \/home\/dwe&gt; Install-Module -Name AWS.Tools.Installer -Force    \nPS \/home\/dwe&gt; Install-Module -name AWSPowerShell.NetCore -Force \n<\/pre>\n<p>Now, dependend on which AWS services you want to work with, just install what you need (in this example EC2, S3 and WorkSpaces):<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1; highlight: [1,4]\">\nPS \/home\/dwe&gt; Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp -Force                                                                             \nInstalling module AWS.Tools.EC2 version 4.0.6.0                                                                                                             \nInstalling module AWS.Tools.S3 version 4.0.6.0                                                                                                              \nPS \/home\/dwe&gt; Install-AWSToolsModule AWS.Tools.Workspaces -CleanUp -Force                                                                                   \nInstalling module AWS.Tools.WorkSpaces version 4.0.6.0  \n<\/pre>\n<p>Once you have that ready you can use the AWS tools for PowerShell to generate a template you can start with:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1; highlight: [1,18,22]\">\nPS \/home\/dwe&gt; Get-AWSPowerShellLambdaTemplate                                                                                                                                                                                                                                                                           Template                     Description                                                                                                                    \n--------                     -----------                                                                                                                    \nBasic                        Bare bones script                                                                                                              \nCloudFormationCustomResource PowerShell handler base for use with CloudFormation custom resource events\nCodeCommitTrigger            Script to process AWS CodeCommit Triggers\nDetectLabels                 Use Amazon Rekognition service to tag image files in S3 with detected labels.\nKinesisStreamProcessor       Script to be process a Kinesis Stream\nS3Event                      Script to process S3 events\nS3EventToSNS                 Script to process SNS Records triggered by S3 events\nS3EventToSNSToSQS            Script to process SQS Messages, subscribed to an SNS Topic that is triggered by S3 events\nS3EventToSQS                 Script to process SQS Messages triggered by S3 events\nSNSSubscription              Script to be subscribed to an SNS Topic\nSNSToSQS                     Script to be subscribed to an SQS Queue, that is subscribed to an SNS Topic\nSQSQueueProcessor            Script to be subscribed to an SQS Queue\n\n\nPS \/home\/dwe&gt; cd .\/Documents\/aws\nPS \/home\/dwe\/Documents\/aws&gt; New-AWSPowerShellLambda -ScriptName MyFirstPowershellLambda -Template Basic\nConfiguring script to use installed version 4.0.6.0 of (@{ ModuleName = 'AWS.Tools.Common'; ModuleVersion = '4.0.5.0' }.Name)\nCreated new AWS Lambda PowerShell script MyFirstPowershellLambda.ps1 from template Basic at \/home\/dwe\/Documents\/aws\/MyFirstPowershellLambda\n\nPS \/home\/dwe\/Documents\/aws\/MyFirstPowershellLambda&gt; ls\nMyFirstPowershellLambda.ps1  readme.txt\n<\/pre>\n<p>The generated template is quite simple but it gives you an idea how to start:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nPS \/home\/dwe\/Documents\/aws\/MyFirstPowershellLambda&gt; cat .\/MyFirstPowershellLambda.ps1\n# PowerShell script file to be executed as a AWS Lambda function. \n# \n# When executing in Lambda the following variables will be predefined.\n#   $LambdaInput - A PSObject that contains the Lambda function input data.\n#   $LambdaContext - An Amazon.Lambda.Core.ILambdaContext object that contains information about the currently running Lambda environment.\n#\n# The last item in the PowerShell pipeline will be returned as the result of the Lambda function.\n#\n# To include PowerShell modules with your Lambda function, like the AWS.Tools.S3 module, add a \"#Requires\" statement\n# indicating the module and version. If using an AWS.Tools.* module the AWS.Tools.Common module is also required.\n\n#Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion='4.0.6.0'}\n\n# Uncomment to send the input event to CloudWatch Logs\n# Write-Host (ConvertTo-Json -InputObject $LambdaInput -Compress -Depth 5)\n<\/pre>\n<p>Just add the modules for the specific AWS services you want to work with in the &#8220;#Requires&#8221; section (you need to install them before of course) and write your script:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1; highlight: [13,14,15]\">\nPS \/home\/dwe\/Documents\/aws\/MyFirstPowershellLambda&gt; cat .\/MyFirstPowershellLambda.ps1\n# PowerShell script file to be executed as a AWS Lambda function. \n# \n# When executing in Lambda the following variables will be predefined.\n#   $LambdaInput - A PSObject that contains the Lambda function input data.\n#   $LambdaContext - An Amazon.Lambda.Core.ILambdaContext object that contains information about the currently running Lambda environment.\n#\n# The last item in the PowerShell pipeline will be returned as the result of the Lambda function.\n#\n# To include PowerShell modules with your Lambda function, like the AWS.Tools.S3 module, add a \"#Requires\" statement\n# indicating the module and version. If using an AWS.Tools.* module the AWS.Tools.Common module is also required.\n\n#Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion='4.0.6.0'}\n#Requires -Modules @{ModuleName='AWS.Tools.S3';ModuleVersion='4.0.6.0'}\n#Requires -Modules @{ModuleName='AWS.Tools.EC2';ModuleVersion='4.0.6.0'}\n\n# Uncomment to send the input event to CloudWatch Logs\n# Write-Host (ConvertTo-Json -InputObject $LambdaInput -Compress -Depth 5)\nWrite-Output \"Test\"\n<\/pre>\n<p>The AWS documentation for the PowerShell Cmdlets is <a href=\"https:\/\/docs.aws.amazon.com\/powershell\/latest\/reference\/Index.html\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>Assuming that the script is completed (the above script does a simple print to the console) you need to deploy it to Lambda. For Python all you need to do is to zip your code and upload that to AWS Lambda. For PowerShell you need to call the &#8220;Publish-AWSPowerShellLambda&#8221; module passing in the script, a name for the Lambda function and the <a href=\"https:\/\/docs.aws.amazon.com\/general\/latest\/gr\/rande.html\" target=\"_blank\" rel=\"noopener noreferrer\">AWS region<\/a> you want to have the function deployed to:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nPS \/home\/dwe\/Documents\/aws\/MyFirstPowershellLambda&gt; Publish-AWSPowerShellLambda -ScriptPath .\/MyFirstPowershellLambda.ps1 -Name MyFirstPowershellLambda  -Region eu-central-1\n<\/pre>\n<p>&#8230; and this will fail with:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nGet-Command: \/home\/dwe\/.local\/share\/powershell\/Modules\/AWSLambdaPSCore\/2.0.0.0\/Private\/_DeploymentFunctions.ps1:544\nLine |\n 544 |      $application = Get-Command -Name dotnet\n     |                     ~~~~~~~~~~~~~~~~~~~~~~~~\n     | The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,\n     | or if a path was included, verify that the path is correct and try again.\n\nException: \/home\/dwe\/.local\/share\/powershell\/Modules\/AWSLambdaPSCore\/2.0.0.0\/Private\/_DeploymentFunctions.ps1:547\nLine |\n 547 |          throw '.NET Core 3.1 SDK was not found which is required to b \u2026\n     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n     | .NET Core 3.1 SDK was not found which is required to build the PowerShell Lambda package bundle. Download the .NET Core 3.1 SDK from\n     | https:\/\/www.microsoft.com\/net\/download\n<\/pre>\n<p>The error message is quite clear: You need to install the &#8220;.NET Core 3.1 SDK&#8221; but as we added the Microsoft repositories above this is just a matter of (again, adjust for your package manager):<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ sudo apt-get install -y dotnet-sdk-3.1\n<\/pre>\n<p>Trying the same again and this time it succeeds:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nPS \/home\/dwe\/Documents\/aws\/MyFirstPowershellLambda&gt; Publish-AWSPowerShellLambda -ScriptPath .\/MyFirstPowershellLambda.ps1 -Name MyFirstPowershellLambda  -Region eu-central-1\nStaging deployment at \/tmp\/MyFirstPowershellLambda\nConfiguring PowerShell to version 7.0.0\nGenerating C# project \/tmp\/MyFirstPowershellLambda\/MyFirstPowershellLambda.csproj used to create Lambda function bundle.\nGenerating \/tmp\/MyFirstPowershellLambda\/Bootstrap.cs to load PowerShell script and required modules in Lambda environment.\nGenerating aws-lambda-tools-defaults.json config file with default values used when publishing project.\nCopying PowerShell script to staging directory\n...\n... zipping:   adding: Namotion.Reflection.dll (deflated 58%)\n... zipping:   adding: System.Diagnostics.PerformanceCounter.dll (deflated 60%)\n... zipping:   adding: MyFirstPowershellLambda.ps1 (deflated 53%)\n... zipping:   adding: System.Management.dll (deflated 62%)\n... zipping:   adding: Markdig.Signed.dll (deflated 62%)\n... zipping:   adding: libpsl-native.so (deflated 69%)\n...\nCreating new Lambda function MyFirstPowershellLambda\nEnter name of the new IAM Role:\ndwe-tmp-role\n...\nSelect IAM Policy to attach to the new role and grant permissions\n    1) AWSLambdaFullAccess (Provides full access to Lambda, S3, DynamoDB, CloudWatch Metrics and  ...)\n    2) AWSLambdaReplicator\n...\n1\nWaiting for new IAM Role to propagate to AWS regions\n...............  Done\nNew Lambda function created\n<\/pre>\n<p>Heading over to the AWS console we can see that the function is there:<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_011-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_011-1.jpg\" alt=\"\" width=\"1616\" height=\"260\" class=\"aligncenter size-full wp-image-40645\" \/><\/a><br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-2.jpg\" alt=\"\" width=\"1500\" height=\"508\" class=\"aligncenter size-full wp-image-40647\" \/><\/a><\/p>\n<p>Hope this helps&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve done some Lambda functions with Python in the past and it was quite easy to publish that to Lambda (by just uploading a zip file with all my code and dependencies). You might ask yourself why I want to do that with PowerShell but the reason is quite simple: There was a requirement at [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":14299,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1865],"tags":[1999,272],"type_dbi":[],"class_list":["post-14296","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","tag-lambda","tag-powershell"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Publishing a PowerShell script to AWS Lambda - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Publishing a PowerShell script to AWS Lambda\" \/>\n<meta property=\"og:description\" content=\"I&#8217;ve done some Lambda functions with Python in the past and it was quite easy to publish that to Lambda (by just uploading a zip file with all my code and dependencies). You might ask yourself why I want to do that with PowerShell but the reason is quite simple: There was a requirement at [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-16T11:20:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1788\" \/>\n\t<meta property=\"og:image:height\" content=\"605\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Daniel Westermann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@westermanndanie\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Westermann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/\"},\"author\":{\"name\":\"Daniel Westermann\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"headline\":\"Publishing a PowerShell script to AWS Lambda\",\"datePublished\":\"2020-06-16T11:20:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/\"},\"wordCount\":590,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/Selection_012-3.png\",\"keywords\":[\"Lambda\",\"PowerShell\"],\"articleSection\":[\"AWS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/\",\"name\":\"Publishing a PowerShell script to AWS Lambda - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/Selection_012-3.png\",\"datePublished\":\"2020-06-16T11:20:11+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/Selection_012-3.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/Selection_012-3.png\",\"width\":1788,\"height\":605},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/publishing-a-powershell-script-to-aws-lambda\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Publishing a PowerShell script to AWS Lambda\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\",\"name\":\"Daniel Westermann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"caption\":\"Daniel Westermann\"},\"description\":\"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\\\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/westermanndanie\"],\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/daniel-westermann\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Publishing a PowerShell script to AWS Lambda - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/","og_locale":"en_US","og_type":"article","og_title":"Publishing a PowerShell script to AWS Lambda","og_description":"I&#8217;ve done some Lambda functions with Python in the past and it was quite easy to publish that to Lambda (by just uploading a zip file with all my code and dependencies). You might ask yourself why I want to do that with PowerShell but the reason is quite simple: There was a requirement at [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/","og_site_name":"dbi Blog","article_published_time":"2020-06-16T11:20:11+00:00","og_image":[{"width":1788,"height":605,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-3.png","type":"image\/png"}],"author":"Daniel Westermann","twitter_card":"summary_large_image","twitter_creator":"@westermanndanie","twitter_misc":{"Written by":"Daniel Westermann","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/"},"author":{"name":"Daniel Westermann","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"headline":"Publishing a PowerShell script to AWS Lambda","datePublished":"2020-06-16T11:20:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/"},"wordCount":590,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-3.png","keywords":["Lambda","PowerShell"],"articleSection":["AWS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/","url":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/","name":"Publishing a PowerShell script to AWS Lambda - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-3.png","datePublished":"2020-06-16T11:20:11+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-3.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Selection_012-3.png","width":1788,"height":605},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/publishing-a-powershell-script-to-aws-lambda\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Publishing a PowerShell script to AWS Lambda"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66","name":"Daniel Westermann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","caption":"Daniel Westermann"},"description":"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.","sameAs":["https:\/\/x.com\/westermanndanie"],"url":"https:\/\/www.dbi-services.com\/blog\/author\/daniel-westermann\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=14296"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14296\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/14299"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=14296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=14296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=14296"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=14296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}