使用Terraform-can连接的AWS Fargate上的EFS
美好的一天,
我从ECS Fargate连接到EFS模块时遇到了问题。一切都建在Terraform中。以下是相关文件:
efs.tf
resource "aws_efs_file_system" "efs" {
creation_token = "meltano-efs-file-system"
tags = {
Name = "meltano-efs-file-system"
}
}
resource "aws_efs_mount_target" "mount" {
count = length(data.aws_subnet_ids.private.ids)
file_system_id = aws_efs_file_system.efs.id
subnet_id = tolist(data.aws_subnet_ids.private.ids)[count.index]
security_groups = [data.aws_security_group.default.id]
}
卷中的ECS TAK定义
volume {
name = "meltano-system-db-volume"
efs_volume_configuration {
file_system_id = aws_efs_file_system.efs.id
root_directory = "/meltano-system-db"
transit_encryption = "ENABLED"
}
}
任务定义:
{
"name": "meltano-system-db",
"image": "postgres",
"cpu": XXX,
"memory": XXX,
"essential": true,
"portMappings": [
{
"hostPort": XXX,
"protocol": "XXX",
"containerPort": XXX
}
]
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${aws_cloudwatch_meltano_system_db_log_group_name}",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
},
"mountPoints": [
{
"sourceVolume": "meltano-system-db-volume",
"containerPath": "/var/lib/postgresql/data"
}
],
"volumesFrom": []
},
是否有人遇到过此方法 /对如何解决的想法?在日志中,似乎我们的数据库无法连接,因此停止。
更新 具体问题:我们运行了3个parrall任务,其中只有一个要连接到ECS。我们没有从此特定任务中获得日志,从其他两个任务中,我们得到无法连接到Postgres DB,重试...
足够重试后,我们会得到错误: ResourceInitializationerror:无法调用EFS UTILS命令来设置EFS卷:STDERR:无法解决“ FS-0F2315B76C221163F.EFS.US-EATS.US-EATS-1.AMAZONAWS.COM.AMAZONAWS.COM” - 检查您的文件系统ID是否正确。有关更多详细信息,请参见https://docs.aws.amazon.com/console/efs/mount-dns-name。 :失败的EFS UTILS命令执行;代码:1
我不知道为什么我们不使用RDS;这是我吞噬的建筑,我是Infra游戏的新手。
Good day,
I'm having issues connecting to my EFS module from ECS fargate. Everything is built in Terraform. Here are the relevent files:
efs.tf
resource "aws_efs_file_system" "efs" {
creation_token = "meltano-efs-file-system"
tags = {
Name = "meltano-efs-file-system"
}
}
resource "aws_efs_mount_target" "mount" {
count = length(data.aws_subnet_ids.private.ids)
file_system_id = aws_efs_file_system.efs.id
subnet_id = tolist(data.aws_subnet_ids.private.ids)[count.index]
security_groups = [data.aws_security_group.default.id]
}
Volume in ecs tak definitions
volume {
name = "meltano-system-db-volume"
efs_volume_configuration {
file_system_id = aws_efs_file_system.efs.id
root_directory = "/meltano-system-db"
transit_encryption = "ENABLED"
}
}
Task definition:
{
"name": "meltano-system-db",
"image": "postgres",
"cpu": XXX,
"memory": XXX,
"essential": true,
"portMappings": [
{
"hostPort": XXX,
"protocol": "XXX",
"containerPort": XXX
}
]
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${aws_cloudwatch_meltano_system_db_log_group_name}",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
},
"mountPoints": [
{
"sourceVolume": "meltano-system-db-volume",
"containerPath": "/var/lib/postgresql/data"
}
],
"volumesFrom": []
},
Has anyone ever encountered this / have any ideas on how to solve? In the logs, it simply seems like our database can't connect, so it stops.
Update
Specific issue: We have 3 parralel tasks running, only one of which we want to connect to ECS. We get no logs from this specific task, and from the other 2 we get could not connect to postgres db, retrying ...
After enough retries, we would get the error:ResourceInitializationError: failed to invoke EFS utils commands to set up EFS volumes: stderr: Failed to resolve "fs-0f2315b76c221163f.efs.us-east-1.amazonaws.com" - check that your file system ID is correct. See https://docs.aws.amazon.com/console/efs/mount-dns-name for more detail. : unsuccessful EFS utils command execution; code: 1
I don't know why we are not using RDS; this is an architecture that I inherted, and I'm quite new to the infra game.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论