ECS
Monitor ECS task network traffic with the Alma Packet Sensor sidecar.

How it works
Prerequisites
Install (Terraform)
1
1) Identify your VPC and subnet IDs
Option A: AWS Console
Option B: AWS CLI
# List services in a cluster
aws ecs list-services --cluster YOUR_CLUSTER_NAME
# Get one subnet ID from the service
aws ecs describe-services \
--cluster YOUR_CLUSTER_NAME \
--services YOUR_SERVICE_NAME \
--query 'services[0].networkConfiguration.awsvpcConfiguration.subnets[0]' \
--output textSUBNET_ID=$(
aws ecs describe-services \
--cluster YOUR_CLUSTER_NAME \
--services YOUR_SERVICE_NAME \
--query 'services[0].networkConfiguration.awsvpcConfiguration.subnets[0]' \
--output text
)
aws ec2 describe-subnets \
--subnet-ids "$SUBNET_ID" \
--query 'Subnets[0].VpcId' \
--output text2
2) Configure Terraform variables
# Required: VPC ID (subnet is optional)
alma_receiver_vpc_id = "vpc-0a1b2c3d4e5f6g7h8" # replace with your VPC ID
# Optional: if empty, a subnet is auto-selected
alma_receiver_subnet_id = ""
# Deploy an Alma Receiver EC2 instance (set false if you already run one)
deploy_alma_receiver = trueterraform output alma_receiver_private_ip3
3) Attach the Packet Sensor sidecar to your ECS task definition
Option A: Use the automation script
Option B: Add the sidecar manually
resource "aws_ecs_task_definition" "your_task" {
family = "your-app"
# ... other configuration
container_definitions = jsonencode([
{
name = "your-app"
image = "your-image:latest"
# ... your app container config
},
{
name = "alma-packet-sensor"
image = "public.ecr.aws/r1b5k6e6/alma-packet-sensor:0.0.1"
essential = false
environment = [
{
name = "CAPTURE_BPF_FILTER"
value = "tcp"
},
{
name = "SERVER_ADDRESS"
value = var.deploy_alma_receiver && var.alma_receiver_vpc_id != "" ?
aws_instance.alma_receiver[0].private_ip :
var.alma_server_address
}
]
}
])
}Alternative: use an existing receiver
Validate
Last updated

