通过 terraform 的 AWS lambda 函数 - 无法解压缩上传的文件。请检查您的文件,然后尝试重新上传

通过 terraform 的 AWS lambda 函数 - 无法解压缩上传的文件。请检查您的文件,然后尝试重新上传

我正在使用 terraform 创建 lambda 函数,并且 S3 中已经有 zip 包:

{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "fa9b0e8b-02a6-4eaf-81ae-bf30fc6a1153"
  },
  Message_: "Could not unzip uploaded file. Please check your file, then try to upload again.",
  Type: "User"
}

我的代码如下所示:

resource "aws_lambda_function" "test_lambda" {
  s3_bucket = "bucket_name"
  s3_key = "lambda.zip"
  function_name = "Function_Test"
  role = aws_iam_role.test_lambda_role.arn
  handler = "config.lambda_handler"
  runtime = "python3.8"
  timeout = 180
  vpc_config {
    subnet_ids = ["subnet-123"]
    security_group_ids = ["sg-123"]
  }

  environment {
    variables = {
      LOG_LEVEL = "DEBUG"
      host = "https://abc:9098"
    }
  }
}

相关内容