I am trying to create a Fargate container with a mounted EFS volume via access point, all being created through cloudformation. I see the EFS created in the portal however the ECS task is failing with:
Failed to resolve "fs-XXX.efs.eu-west-2.amazonaws.com" - check that your file system ID is correct
Before adding the accesspoint the mounting worked. I need the accesspoint since the container is using non-root user.
The VPC has DNS and hostname lookup enabled.
Here is the cloudformation template:
https://pastebin.com/CgtvV17B
the problem was missing EFS Mount Target https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-mounttarget.html
I think the fargate tasks can't reach the EFS system, check that the EFS subnets are reachable from the Fargate ( deployed in the same subnets at least), and the route tables are well configured. The security group of the ECS and EFS are well configured ( check if your EFS authorize the TCP 2049).
Also check the version of the Fargate, I think its working with EFS just for the version > 1.4
Try to deploy an instance EC2 with the same configuration ( same VPC and subnet properties ) and check if it can reach the EFS.
Related
I have an EFS file system. I have created two mounts one for us-east-1a and another for us-east-1b and both are in the same VPC. Now I have a requirement to add a mount point and it's in a different VPC but in the same account. When I try to create the mount target I get the below error
aws efs create-mount-target --file-system-id fs-abcdef --subnet-id subnet-156fd195808k8l --security-groups sg-99b88u518a368dp
An error occurred (MountTargetConflict) when calling the CreateMountTarget operation: requested subnet for new mount target is not in the same VPC as existing mount targets
is there a way I can use the EFS in two different VPCs?
VPC peering OR Transit Gateway is enough in order for NFS client from different VPC to connect to EFS in separate VPC.
Only one mount target for a certain EFS is needed per AZ. The error shows that you already have mount target for the specific EFS.
To connect your NFS client you can follow the AWS provide documentation
I am trying to launch fargate task from EFS . My EFS filesystem is mounted on Same subnet, VPC and security group where my ECS is mounted.
still I am facing the same issue "failed to invoke EFS utils commands to set up EFS volumes: stderr: Failed to resolve "fs-0b5a160420b31f547.efs.us-east-1.amazonaws.com" - check that your file system ID is correct, and ensure that the VPC has an EFS mount target for this file system ID"
In my security group of ECS and EFS 2049 is enabled on inbound and Outbound network.
I find the solution by my own I haven't done VPC DNS name enabled as it was set as disable i changed it to enabled and then ITWoRKS.
I am trying to mount a persistent storage in a Fargate container.
I have set up an EFS file system.
I have set up an ECS Cluster.
EFS and ECS share one subnet.
When I try to create a task definition, I choose Fargate and then on Add container. I scroll down to Storage and Logging and cannot choose the EFS file system in Mount points. I cannot choose anything here, the only choice I have is: <None>
This SO question suggests it is possible, but here it was answered using the AWS Cli Application. I wonder if I cannot just do it from the AWS Console (which is the web interface).
Before you can setup Mount point in your Container definition, you have to setup Volume in your Task definition:
I am creating an AWS ECS cluster (Networking + Linux).
I follow all the steps, set up the subnets and use the existing VPC and the EC2 instance is created.
However, when I go into my cluster > ECS Instances I don't see any EC2 instances there. It doesn't seem to register there.
My EC2 instance has a public IP so that should not be an issue. What could be the problem?
You haven't specified in the question, but normally you also should modify your UserData so that it registers with the non-default cluster:
#!/bin/bash
echo ECS_CLUSTER=<your-cluster-name> >> /etc/ecs/ecs.config
Also Amazon ECS-optimized AMI should be used which has pre-installed ECS Agent.
Edit: Also need to make sure that instances have access to the ECS Service, for example by having public IP and internet access. Without that, ECS Agent won't be able to communicate with the ECS Service.
UserData in console can be specified in the following configuration:
You can also use Launch Templates or Launch Configurations to specify the UserData reduce the amount of work needed when launching new instances.
I want to persist my mongodb data in ecs cluster using EFS. So, I followed the below approach.
created a cluster under EC2 instance
Attached EFS to the EC2 cluster Instance
Created task definitions and services.
Ran services on the EFS mounted EC2 Cluster
Now, everything is going smooth when the containers are getting updated or terminated. But, when the entire ec2 instance is terminated. AWS cloud formation is creating EC2 instance without mounting EFS as expected. Can someone help me how to get EFS attached automatically when the EC2 instance gets terminated and recreated by CloudFormation. I even tried custom ecs images. But, the instances are not getting created as there is no cloud formation template getting created.