- Newest
- Most votes
- Most comments
Hello.
It is possible to attach EBS volumes with ECS Fargate.
This is now possible with the January 2024 update.
https://aws.amazon.com/about-aws/whats-new/2024/01/amazon-ecs-fargate-integrate-ebs/?nc1=h_ls
Try attaching the IAM policy "AmazonECSInfrastructureRolePolicyForVolumes" to the infrastructure role.
This IAM role is required by Fargate to create an EBS volume.
Infrastructure roles can be specified when configuring the ECS service or when starting a standalone task, not in the task definition.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonECSInfrastructureRolePolicyForVolumes
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/infrastructure_IAM_role.html
The Last Status is not underlined and hence not clickable. It seems that it gets a Stop request immediately after deployment.
Also documentation says EBS can be attached to a standalone task. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html
answered 2 years ago
There are a few issues with your ECS task deployment that are likely causing it to fail:
-
EBS volumes with Fargate: Unfortunately, AWS Fargate does not support using Amazon EBS volumes directly. Fargate tasks can only use ephemeral storage or Amazon EFS for persistent storage. Your task definition includes an EBS volume, which is not compatible with Fargate.
-
Volume configuration: The volume you've defined in your task definition (
neo4j-data-volume-dev) is not properly configured for Fargate. Fargate tasks require specific volume configurations, such as EFS volumes or bind mounts. -
CloudWatch Logs: While you've configured logging, the fact that no log stream is being created suggests that the task is failing before it can even start logging. This is likely due to the incompatible volume configuration.
To resolve these issues and successfully deploy your Neo4j container on ECS with Fargate, consider the following steps:
-
Remove the EBS volume configuration from your task definition.
-
If you need persistent storage, consider using Amazon EFS instead. You'll need to create an EFS file system and configure it in your task definition.
-
If you don't need persistent storage, you can use the ephemeral storage provided by Fargate, but be aware that data will be lost when the task stops.
-
Ensure that your task execution role has the necessary permissions to create and write to CloudWatch log groups and streams.
-
Double-check that your VPC and security group configurations allow the necessary network traffic for your Neo4j container.
To debug Fargate task issues:
-
Check the ECS console for any error messages in the stopped tasks section.
-
Verify that your container can run locally using Docker to ensure there are no issues with the image itself.
-
Review the CloudWatch logs once you've resolved the initial deployment issues.
-
Consider temporarily increasing the logging detail in your Neo4j configuration to get more information during startup.
By addressing these points, particularly the EBS volume incompatibility with Fargate, you should be able to successfully deploy your Neo4j container on ECS with Fargate.
Sources
AWS Fargate for Amazon ECS - Amazon Elastic Container Service
Amazon ECS task definition differences for the Fargate launch type - Amazon Elastic Container Service
How to debug failed ECS deployment? | AWS re:Post
answered 2 years ago
Relevant content
asked 2 years ago
- AWS OFFICIALUpdated a year ago

You need to set the appropriate IAM policy for the IAM role you specify when launching a standalone task as shown in the image below. Please check the execution history of the "CreateVolume" API from the CloudTrail event history and see if any errors occur.
This worked, I had created a role with some permissions for the arn:aws:ec2:::volume/* resource but looks like some were missing. The deployment seems to fail with permission errors for some missing permissions and but silently stops for others looks like.
Thanks!
Is it possible to attach an existing EBS volume to a task?