问题的解决方案或解决方法。
如果 Firehose 是提前单独创建的,则下面的 Terraform API Gateway 与 Firehose 的集成有效。
resource "aws_api_gateway_integration" "click_put" {
rest_api_id = data.aws_api_gateway_rest_api.mysfit.id
resource_id = aws_api_gateway_resource.click.id
type = "AWS"
uri = "arn:aws:apigateway:${var.REGION}:firehose:action/PutRecord"
credentials = aws_iam_role.api_click.arn
http_method = aws_api_gateway_method.click_put.http_method
integration_http_method = "POST"
request_parameters = {
"integration.request.header.Content-Type" = "'application/x-amz-json-1.1'"
}
passthrough_behavior = "NEVER"
request_templates = {
"application/json" = <<EOF
{
"DeliveryStreamName": "${local.firehose_name}",
"Record": {
"Data": "$util.base64Encode($input.json('$'))"
}
}
EOF
}
}
...
resource "aws_api_gateway_integration_response" "click_put" {
rest_api_id = data.aws_api_gateway_rest_api.mysfit.id
resource_id = aws_api_gateway_resource.click.id
http_method = aws_api_gateway_method.click_put.http_method
status_code …Run Code Online (Sandbox Code Playgroud) amazon-web-services terraform-provider-aws amazon-kinesis-firehose amazon-api-gateway
首次使用阶段名称创建 API 网关部署,并创建阶段以配置 X-RAY 或 CloudWatch 日志记录时,会导致“阶段已存在”。
resource "aws_api_gateway_deployment" "this" {
rest_api_id = aws_api_gateway_rest_api.mysfit.id
stage_name = "${var.ENV}"
variables = {
deployed_at = timestamp()
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_api_gateway_stage" "this" {
stage_name = var.ENV
rest_api_id = aws_api_gateway_rest_api.mysfit.id
deployment_id = aws_api_gateway_deployment.this.id
dynamic "access_log_settings" {
for_each = var.enable_apigw_stage_cloudwatch_access_log ? [1] : []
content {
destination_arn = module.cloudwatch.cloudwatch_loggroup_arn
format = file("${path.module}/apigw_access_log_format.json")
}
}
xray_tracing_enabled = var.xray_tracing_enabled
tags = {
Project = var.PROJECT
Environment = var.ENV
}
}
Run Code Online (Sandbox Code Playgroud)
解决方法是省略 …
amazon-web-services terraform-provider-aws amazon-api-gateway
AWS 文档说,
私有 API 不支持自定义域名。
来源:https : //docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-apis.html
这究竟是什么意思?我可以将自定义域名附加到 Private API。
但是,我面临 SSL 证书的问题。
我们正在尝试根据https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html利用 AWS API 网关中的 $default 路径
像这样配置 api 网关,利用$default 作为路由之一
/
/-default
ANY
/api
/{proxy=}
Run Code Online (Sandbox Code Playgroud)
当我们尝试在$default路径和 GET 调用上调用 api 网关时
https://apigateway.amazonaws.com/prod/test
Run Code Online (Sandbox Code Playgroud)
我们假设它会调用默认路径,但它没有
message: "Missing Authentication Token"
Run Code Online (Sandbox Code Playgroud)
但是当我们这样做时
https://apigateway.amazonaws.com/prod/api/test
Run Code Online (Sandbox Code Playgroud)
该API集成时调用
注意:我们已经尝试配置贪婪路径{proxy+}而不是 $default ,因为贪婪路径总是优先并且 /api 路由也被路由到贪婪路径
社区为我们指明正确方向的任何帮助都会有很大帮助
amazon-web-services aws-api-gateway api-gateway amazon-api-gateway
api-gateway ×1