简体   繁体   English

通过云形成堆栈的ECS AWS服务发现

[英]AWS service discovery for ECS through cloud formation stack

I have configured service discovery in aws ECS service for my WSO2 gateway set up. 我已经在AWS ECS服务中为WSO2网关设置配置了服务发现。 I am able to do everything successfully manually but now I need to create cloud stack for same. 我能够手动成功完成所有操作,但是现在我需要为其创建云堆栈。 When I checked aws cloud formation documentation there is AWS::ECS::Service and AWS::ServiceDiscovery::Service separately but I don't have clue how to link AWS::ECS::Service with route 53 DNS created through AWS::ServiceDiscovery::Service. 当我查看AWS云形成文档时,分别有AWS :: ECS :: Service和AWS :: ServiceDiscovery :: Service,但是我不知道如何将AWS :: ECS :: Service与通过AWS创建的路由53 DNS链接: :ServiceDiscovery :: Service。 Can someone help me as I am not able to know how to refer service discovery from ECS services in cloud stack. 有人可以帮助我,因为我不知道如何从云堆栈中的ECS服务引用服务发现。

在此处输入图片说明

Found below solution in cloudstack. 在cloudstack中找到以下解决方案。

在此处输入图片说明

I am not sure about cloud formation. 我不确定云的形成。 But in terraform, You have to seprately mention a resource like below. 但是在terraform中,您必须单独提及如下资源。

resource "aws_vpc" "example" {
  cidr_block = "10.0.0.0/16"
}

resource "aws_service_discovery_private_dns_namespace" "example" {
  name = "example.terraform.local"
  description = "example"
  vpc = "${aws_vpc.example.id}"
}

resource "aws_service_discovery_service" "example" {
  name = "example"
  dns_config {
    namespace_id = "${aws_service_discovery_private_dns_namespace.example.id}"
    dns_records {
      ttl = 10
      type = "A"
    }
    routing_policy = "MULTIVALUE"
  }

  health_check_custom_config {
    failure_threshold = 1
  }
}

Ref: https://www.terraform.io/docs/providers/aws/r/service_discovery_service.html 参考: https : //www.terraform.io/docs/providers/aws/r/service_discovery_service.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM