小编Ocf*_*mem的帖子

Terraform AWS:无法使用通过 aws_launch_configuration 启动的 AWS EC2 实例重用先前创建的 root_block_device

我已经使用 terraform 将 ELK 堆栈部署到 AWS ECS。几个星期以来,一切都运行良好,但 2 天前我不得不重新启动实例。

遗憾的是,新实例并不依赖于现有卷来挂载根块设备。因此,我的 Kibana 实例无法再使用我的所有 elasticsearch 数据。

数据仍然在这里,在以前的卷上,目前没有使用。

所以我尝试了很多方法来将这个卷附加到“dev/xvda”,但没有例如:

  • 使用 ebs_block_device 而不是 root_block_device 使用
  • 当实例已经运行时交换“dev/xvda”

我正在使用带有 aws_launch_configuration 的 aws_autoscaling_group。

resource "aws_launch_configuration" "XXX" {
  name = "XXX"
  image_id = data.aws_ami.latest_ecs.id
  instance_type = var.INSTANCE_TYPE
  security_groups = [var.SECURITY_GROUP_ID]
  associate_public_ip_address = true
  iam_instance_profile = "XXXXXX"

  spot_price = "0.04" 
  lifecycle {
    create_before_destroy = true

  }

  user_data = templatefile("${path.module}/ecs_agent_conf_options.tmpl",
    {
      cluster_name = aws_ecs_cluster.XXX.name
    }
  )

//The volume i want to reuse was created with this configuration. I though it …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-ecs terraform terraform-provider-aws

6
推荐指数
1
解决办法
655
查看次数