APIGateway+Lambda-方法没有定义集成
创始人
2024-09-07 16:00:15
0

在Terraform中定义API Gateway与Lambda函数的集成关系

例如:

resource "aws_api_gateway_rest_api" "example" {
  name = "example_api"
}

resource "aws_api_gateway_resource" "example" {
  rest_api_id = aws_api_gateway_rest_api.example.id
  parent_id   = aws_api_gateway_rest_api.example.root_resource_id
  path_part   = "example"
}

resource "aws_api_gateway_method" "example" {
  rest_api_id   = aws_api_gateway_rest_api.example.id
  resource_id   = aws_api_gateway_resource.example.id
  http_method   = "POST"
  authorization = "NONE"

  request_parameters = {
    "method.request.body.input" = true
  }

  request_validator_id = aws_api_gateway_request_validator.example.id
}

resource "aws_api_gateway_integration" "example" {
  rest_api_id          = aws_api_gateway_rest_api.example.id
  resource_id          = aws_api_gateway_resource.example.id
  http_method          = aws_api_gateway_method.example.http_method
  integration_http_method = "POST"
  type                 = "AWS_PROXY"
  uri                  = aws_lambda_function.example.invoke_arn
}

resource "aws_api_gateway_deployment" "example" {
  depends_on = [aws_api_gateway_integration.example]
  rest_api_id = aws_api_gateway_rest_api.example.id
  stage_name = "prod"
}

在这个例子中,我们定义了一个API Gateway,一个资源和一个POST方法,并将其与Lambda函数进行了集成。这个集成定义在aws_api_gateway_integration资源中,并指定了Lambda函数的ARN作为URI。最后,我们将API Gateway发布到prod阶段。

这个例子是一个简单的API Gateway到Lambda的集成。在实际应用中,您可能需要更复杂的集成方案,如API Gateway到多个Lambda函数、Lambda函数与其他服务的集成等。要了解更多信息,请查看AWS文档中的API Gateway和Lambda服务。

相关内容

热门资讯

终于知道(we poker)外... 终于知道(we poker)外挂透明挂辅助器(智能ai代打)的确真的有挂(2025已更新)(抖音)1...
必备辅助推荐(pokermas... 必备辅助推荐(pokermaster)外挂透明挂辅助app(透视辅助)都是真的有挂(2025已更新)...
重大科普(aapoker)外挂... 重大科普(aapoker)外挂透明挂辅助机制(透视辅助)本来真的有挂(2021已更新)(头条)1、重...
总算明白(智星德州)外挂透明挂... 总算明白(智星德州)外挂透明挂辅助器(透视)一贯真的有挂(2023已更新)(知乎);1、实时开挂更新...
最新技巧(wepOke)外挂透... 最新技巧(wepOke)外挂透明挂辅助app(辅助挂)都是真的有挂(2022已更新)(今日头条)1、...
每日必看教程(epoker)外... 每日必看教程(epoker)外挂透明挂辅助机制(辅助挂)一直真的有挂(2025已更新)(微博热搜);...
每日必看推荐(聚星扑克德州)外... 每日必看推荐(聚星扑克德州)外挂透明挂辅助脚本(透视辅助)就是真的有挂(2022已更新)(哔哩哔哩)...
盘点几款(约局吧)外挂透明挂辅... 盘点几款(约局吧)外挂透明挂辅助插件(透视辅助)的确真的有挂(2021已更新)(哔哩哔哩)1、玩家可...
实测揭晓(线上wpk德州)外挂... 实测揭晓(线上wpk德州)外挂透明挂辅助工具(智能ai代打)都是真的有挂(2024已更新)(百度)一...
教程攻略(来玩app)外挂透明... 教程攻略(来玩app)外挂透明挂辅助器(透视)一般真的有挂(2023已更新)(知乎)1、全新机制【软...