Search code examples
aws-cdkaws-fargate

Is it possible to create a QueueProcessingFargateService with read-only root filesystem with cdk?


AWS Foundational Security Best Practices v1.0.0 has a high risk check; [ECS.5] ECS containers should be limited to read-only access to root filesystems. The remediation explains how to change this in the console. However, I haven't found a way to do this for a QueueProcessingFargateService using CDK.

If a QueueProcessingFargateService could be created without an image, this could have been solved by calling add_container on the task definition, but image is mandatory so that doesn't work.

Does anyone know if it is possible to create a QueueProcessingFargateService with read-only root filesystem and if so, how?

(I use CDK in Python, but a solution in any other CDK language will be just as useful)


Solution

  • As this isn't a property directly supported on the construct you'll need to use escape hatches to set it:

    https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html#cfn_layer_resource