简体   繁体   中英

Publishing a PowerShell script to AWS Lambda

I'm trying to deploy a PowerShell core script to AWS Lambda. I'm deploying from an EC2 instance.

I'm following AWS Lambda Deployment Package in PowerShell - AWS Lambda , and trying to deploy the exact script they describe. It looks like it's going to work when I run:

Publish-AWSPowerShellLambda -ScriptPath .\LambdaPSTest.ps1 -Name LambdaPSTest -Region us-east-1

but then I get the following error.

Error retrieving configuration for function LambdaPSTest: Response status code does not indicate success: 404 (Not Found).

I'm confused why it looks to be breaking on the region since I set that when I called publish.

Error publishing PowerShell Lambda Function: -1

CALLSTACK:
Command                     Arguments
-------                     ---------
_deployProject
Publish-AWSPowerShellLambda {{Region=us-east-1$null}, {Region=us-east-1$null}, {Region=us-east-1$null}, {Region=us-ea...
<ScriptBlock>               {{=$null}, {=$null}, {=$null}, {=$null}}
At C:\Users\Administrator\Documents\PowerShell\Modules\AWSLambdaPSCore\1.1.0.0\Private\_DeploymentFunctions.ps1:194 char:13
+             throw $msg
+             ~~~~~~~~~~
+ CategoryInfo          : OperationStopped: (Error publishin...
:String) [], RuntimeException
+ FullyQualifiedErrorId : Error publishing PowerShell Lambda Function: -1
CALLSTACK:
Command                     Arguments
-------                     ---------
_deployProject
Publish-AWSPowerShellLambda {{Region=us-east-1$null}, {Region=us-east-1$null}, {Region=us-east-1$null}, {Region=us-ea...
<ScriptBlock>               {{=$null}, {=$null}, {=$null}, {=$null}}

I'm thinking the issue ended up being something to do with the security settings in my enterprise environment.

In case anyone else runs into this, what worked for me was to run

New-AWSPowerShellLambdaPackage -ScriptPath ./fileUploader.ps1 -OutputPackage fileUploader.zip

then upload manually to AWS Lambda

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM