AWS provides this in the documentation here
{
"containerDefinitions": [
{
"name": "container-using-efs",
"image": "amazonlinux:2",
"entryPoint": [
"sh",
"-c"
],
"command": [
"ls -la /mount/efs"
],
"mountPoints": [
{
"sourceVolume": "myEfsVolume",
"containerPath": "/mount/efs",
"readOnly": true
}
]
}
],
"volumes": [
{
"name": "myEfsVolume",
"efsVolumeConfiguration": {
"fileSystemId": "fs-1234",
"rootDirectory": "/path/to/my/data"
}
}
]
}
i have created an EFS file system assigned it with the security group allowing inbound NFS and the EFS uses that security group and the subnet and VPC which my ECS cluster uses
PROBLEM
When i use the AWS management console to create a mount point in my task definition i have to enter the containerPath
else mountPoints
is not reflected in my JSON
QUESTION
1)What should my containerPath
be under mountPoints
?
2)Should i specify a rootDirectory
under efsVolumeConfiguration
?
INFO
1) I am running wordpress on my ECS cluster
2) I want persistent storage for my container that is why i am attempting to mount EFS
3) I want to map all of my wordpress files onto the EFS container so any changes i make are not reversed when the container restarts
This question has been getting a lot of views.. so i wanted to help everyone out
So i mentioned how to use this feature in a blog i have posted here,
Check step 4 to step 7 and step 8 to step 12
This will give you a good idea of how to implement it practically in the AWS Management console
hope this helps the community :)