简体   繁体   English

Terraform 创建的 EC2 实例未与 ECS 集群关联

[英]Terraform created EC2 Instances not associated with ECS Cluster

I'm new Terraform and I'm working on an infrastructure setup for deploying Docker Containers.我是新的 Terraform,我正在研究用于部署 Docker 容器的基础架构设置。 I've based my ECS Cluster off Infrablocks/ECS-Cluster and my Base Networking on Infrablocks/Base-Network .我的 ECS 集群基于Infrablocks/ECS-Cluster ,基础网络基于Infrablocks/Base-Network I've opted to use these due to time constraints on the project.由于项目的时间限制,我选择使用这些。

The problem I'm having is that the two EC2 Container Instances that are created by Infrablocks/ECS-Cluster module are not associated with ECS Cluster that Infrablocks builds.我遇到的问题是由 Infrablocks/ECS-Cluster 模块创建的两个 EC2 容器实例与 Infrablocks 构建的 ECS 集群没有关联。 I've had zero luck determining why.我有零运气来确定原因。 This is blocking my task definitions from being able to run containers in the ECS Cluster because there are no associated EC2 Instances.这会阻止我的任务定义能够在 ECS 集群中运行容器,因为没有关联的 EC2 实例。 I've provided my two dependent module configurations below.我在下面提供了我的两个依赖模块配置。

Thank you in advance for any help you can provide!提前感谢您提供的任何帮助!

没有实例的 EC2

My Terraform thus far:到目前为止,我的 Terraform:

module "base_network" {
source  = "infrablocks/base-networking/aws"
version = "2.3.0"

vpc_cidr                            = "10.0.0.0/16"
region                              = "us-east-1"
availability_zones                  = ["us-east-1a", "us-east-1b"]

component                           = "dev-base-network"
deployment_identifier               = "development"

include_route53_zone_association    = "true"

private_zone_id                     = module.route53.private_zone_id

include_nat_gateway                 = "true"}


module "ecs_cluster" {
source                                  = "infrablocks/ecs-cluster/aws"
version                                 = "2.2.0"

region                                  = "us-east-1"
vpc_id                                  = module.base_network.vpc_id
subnet_ids                              = module.base_network.public_subnet_ids

associate_public_ip_addresses           = "yes"

component                               = "dev"
deployment_identifier                   = "devx"

cluster_name = "services"
cluster_instance_ssh_public_key_path    = "~/.ssh/id_rsa.pub"
cluster_instance_type                   = "t2.small"

cluster_minimum_size                    = 2
cluster_maximum_size                    = 10
cluster_desired_capacity                = 2 }

You'd have to troubleshoot the instance to see why it isn't joining the cluster.您必须对实例进行故障排除才能了解它为什么没有加入集群。 On your EC2 instances (which, I have not looked, but I would hope that the "infrablocks" ecs-cluster module uses an AMI with the ECS agent installed), you can look in /var/log/ecs/ecs-agent.log.在您的 EC2 实例上(我没有查看,但我希望“infrablocks”ecs-cluster 模块使用安装了 ECS 代理的 AMI),您可以查看 /var/log/ecs/ecs-agent。日志。

If the networking configuration is sound, my first guess would be to check the ECS configuration file.如果网络配置合理,我的第一个猜测是检查 ECS 配置文件。 If your module is working properly, it should have populated the config with the cluster name.如果您的模块工作正常,它应该已经使用集群名称填充了配置。 See here for more on that有关更多信息,请参见此处

(I would have commented instead of answered but this account doesn't have enough rep:shrug:) (我会发表评论而不是回答,但这个帐户没有足够的代表:耸耸肩:)

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

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