Can someone please help me with the task definition for using the existing EBS volume with ECS
AWS documentation says
You can attach at most one Amazon EBS volume to each Amazon ECS task, and it must be a new volume. You can't attach an existing Amazon EBS volume to a task. However, you can configure a new Amazon EBS volume at deployment using the snapshot of an existing volume
I wish to achieve the above i.e. create a ECS task with existing EBS volume as a data volume and my scanner image will scan the data volume
I wrote the following task definition but I am confused how to use the mountOptions to use an existing snapshot
{
"containerDefinitions": [
{
"name": "scanner",
"image": "account-id.dkr.ecr.ap-south-1.amazonaws.com/scanner",
"repositoryCredentials": {
"credentialsParameter": "arn:aws:secretsmanager:ap-southeast-1:account-id:secret:reg-credentials"
},
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/my-application",
"awslogs-region": "region",
"awslogs-stream-prefix": "ecs"
}
}
}
],
"requiresCompatibilities": ["EC2"],
"cpu": "256",
"memory": "512",
"executionRoleArn": "arn:aws:iam::account-id:role/ecsTaskExecutionRole",
"taskRoleArn": "arn:aws:iam::account-id:role/ecsTaskRole"
}