【问题标题】:Cannot configure AWS CloudWatch logs for ECS containers in terraform无法在 terraform 中为 ECS 容器配置 AWS CloudWatch 日志
【发布时间】:2020-07-07 13:11:40
【问题描述】:

我无法在 terraform 中为 ECS 容器配置 AWS CloudWatch 日志。我得到:

CannotStartContainerError: Error response from daemon: failed to initialize logging driver: failed to create Cloudwatch log stream: RequestError: send request failed caused by: Post https://logs.ue-west-1.amazonaws.com/: dial tcp: lookup logs.ue-west-1.am

我的容器定义:

  [{
    "essential": false,
    "memory": 500,
    "name": "client",
    "cpu": 500,
    "image": "some_image",
    "portMappings": [
        {
            "containerPort": 3000,
            "hostPort": 3000
        }
    ],
    "logConfiguration": {
      "logDriver": "awslogs",
      "options": {
        "awslogs-group": "example-production-client",
        "awslogs-stream-prefix": "example-production-client",
        "awslogs-region": "ue-west-1"
      }
    }
  }]

我的 terraform 定义如下:

resource "aws_cloudwatch_log_group" "example-production-client" {
  name = "example-production-client"

  tags = {
    Environment = "production"
  }
}

resource "aws_cloudwatch_log_stream" "example-production-client" {
  name           = "example-production-client"
  log_group_name = aws_cloudwatch_log_group.example-production-client.name
}

我在这里缺少什么?你有过同样的经历吗?

【问题讨论】:

    标签: terraform terraform-provider-aws


    【解决方案1】:

    您输入的区域似乎不正确,请将区域更改为“us-west-1”或“eu-west-1”-

        "awslogs-region": "eu-west-1"
    

    【讨论】:

      猜你喜欢
      • 2020-04-28
      • 2019-03-27
      • 1970-01-01
      • 1970-01-01
      • 2019-12-01
      • 2019-02-02
      • 2016-11-19
      • 2021-09-28
      • 2021-10-30
      相关资源
      最近更新 更多