ECS task definition network mode not recommended
This product is not supported for your selected
Datadog site. (
).
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください。
Id: 9f4a9409-9c60-4671-be96-9716dbf63db1
Cloud Provider: AWS
Platform: Terraform
Severity: Medium
Category: Insecure Configurations
Learn More
Description
This check ensures that the network_mode attribute in an AWS ECS task definition is set to awsvpc. When network_mode is set to any value other than awsvpc, such as none, the tasks do not leverage the enhanced network security and isolation features provided by AWS VPCs. Without awsvpc, the container tasks may lack granular control over network traffic, security group assignment, and enforcement of network policies, making them more exposed to lateral movement and attacks within the cluster. If left unaddressed, this misconfiguration could lead to unauthorized access or unintended network exposure of container workloads, increasing the risk of compromise.
Compliant Code Examples
resource "aws_ecs_task_definition" "negative1" {
family = "service"
network_mode = "awsvpc"
volume {
name = "service-storage"
host_path = "/ecs/service-storage"
}
placement_constraints {
type = "memberOf"
expression = "attribute:ecs.availability-zone in [us-west-2a, us-west-2b]"
}
}
Non-Compliant Code Examples
resource "aws_ecs_task_definition" "positive1" {
family = "service"
network_mode = "none"
volume {
name = "service-storage"
host_path = "/ecs/service-storage"
}
placement_constraints {
type = "memberOf"
expression = "attribute:ecs.availability-zone in [us-west-2a, us-west-2b]"
}
}