【问题标题】:Publish Lambda Function in AWS在 AWS 中发布 Lambda 函数
【发布时间】:2016-10-26 22:04:05
【问题描述】:

如果新的 Lambda 函数不存在,我正在尝试发布它。更新似乎很好用,我可以随意更新它。但是,当我尝试执行发布命令时,我不断收到错误 Member must not be null

$zipFilePath = "E:\ProductName-Dev\release.zip"
$zipFileItem = Get-Item -Path $zipFilePath
$fileStream = $zipFileItem.OpenRead()
$memoryStream = New-Object System.IO.MemoryStream
$fileStream.CopyTo($memoryStream)   

$cmdOutput = Get-LMFunction -FunctionName new-extract;

try{
    if($?) {
        "lambda function already in AWS"               
        Update-LMFunctionCode -FunctionName new-extract -ZipFile $memoryStream -Publish 1

    } else {
        "need to publish new lambda function"           
        Publish-LMFunction -FunctionName new-extract -FunctionZip $zipFilePath -Handler exports.handler -Role arn:aws:iam::0000000:role/my-extract -Region us-east-1 
    }
}
finally {
    $fileStream.Close()
}

如果我在没有所有参数的情况下运行 Publish-LMFunction 并手动输入内容,我仍然会收到错误消息。有什么明显的我在搞砸吗?我相信我已将所有 4 个必填字段添加到我的发布功能中。我也可以在网络控制台中创建这些,所以我认为这不是凭据问题。

【问题讨论】:

    标签: powershell amazon-web-services aws-lambda aws-powershell


    【解决方案1】:

    我只是缺少运行时参数

    Publish-LMFunction -FunctionName $FunctionName -FunctionZip $zipFilePath -Handler exports.handler -Role arn:aws:iam:$AccountNumber:role/$RoleName -Region $Region -Runtime nodejs4.3
    

    他们的文档按要求显示了它,但是当您在 Powershell ISE 中编写时,它不会在字段旁加上星号。

    【讨论】:

      猜你喜欢
      • 2019-01-28
      • 1970-01-01
      • 2020-05-09
      • 1970-01-01
      • 2021-02-12
      • 1970-01-01
      • 2015-11-16
      • 2018-05-19
      • 2016-03-05
      相关资源
      最近更新 更多