Skip to content

Commit d4be66a

Browse files
authored
Merge pull request #46 from redhatrises/add_ecs_fargate
chore: add instructions for running container in ECS Fargate
2 parents 29ab966 + 8614d5a commit d4be66a

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,63 @@ Output will be sent to the console (via ``stdout``) regarding what detections ar
9595

9696
<img src="docs/images/non-interactive.png" alt="non-interactive mode" width="700" height="500">
9797

98+
#### Docker (Non-interactive Mode)
9899
For Docker, use the following command to run the detection container non-interactively:
99100

100101
```bash
101102
sudo docker run --rm quay.io/crowdstrike/detection-container
102103
```
103104

105+
#### Kubernetes (Non-interactive Mode)
104106
For Kubernetes environments, use the following command to run the detection container non-interactively:
105107

106108
```bash
107109
kubectl create -f https://raw.githubusercontent.com/CrowdStrike/detection-container/main/detections.example.yaml
108110
```
111+
112+
#### ECS Fargate (Non-interactive Mode)
113+
114+
For AWS ECS Fargate, use the following commands to run the detection container:
115+
116+
1. Create the CloudWatch log group if it doesn't already exist. Make sure to replace the region with your own:
117+
```bash
118+
AWS_REGION="us-east-1"
119+
120+
aws logs create-log-group \
121+
--log-group-name /ecs/detection-container \
122+
--region $AWS_REGION
123+
```
124+
125+
3. Update and register the task definition:
126+
```bash
127+
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
128+
129+
# Update task definition with your account ID and region
130+
sed -i "s/ACCOUNT_ID/$ACCOUNT_ID/g" ecs-task-definition.json
131+
sed -i "s/AWS_REGION/$AWS_REGION/g" ecs-task-definition.json
132+
133+
# Register the task definition
134+
aws ecs register-task-definition \
135+
--cli-input-json file://ecs-task-definition.json
136+
```
137+
138+
4. Run the task. Make sure to replace `YOUR_CLUSTER`, `YOUR_SUBNET`, and `YOUR_SG` with your own values:
139+
```bash
140+
aws ecs run-task \
141+
--cluster YOUR_CLUSTER \
142+
--task-definition detection-container \
143+
--launch-type FARGATE \
144+
--network-configuration "awsvpcConfiguration={subnets=[YOUR_SUBNET],securityGroups=[YOUR_SG],assignPublicIp=ENABLED}"
145+
```
146+
147+
5. View the logs in CloudWatch:
148+
```bash
149+
# View logs in real-time (replace region if needed)
150+
aws logs tail /ecs/detection-container --follow --region us-east-1
151+
```
152+
153+
> [!NOTE]
154+
> For ECS Fargate deployment, ensure:
155+
> - The ECS execution role has permissions to pull images and write to CloudWatch Logs
156+
> - The CloudWatch log group is created before running the task
157+
> - CrowdStrike Falcon Container Sensor is deployed for detections to appear in the console

ecs-task-definition.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"family": "detection-container",
3+
"networkMode": "awsvpc",
4+
"requiresCompatibilities": ["FARGATE"],
5+
"cpu": "256",
6+
"memory": "512",
7+
"executionRoleArn": "arn:aws:iam::ACCOUNT_ID:role/ecsTaskExecutionRole",
8+
"containerDefinitions": [
9+
{
10+
"name": "detection-container",
11+
"image": "quay.io/crowdstrike/detection-container:latest",
12+
"essential": true,
13+
"entryPoint": ["/entrypoint.sh"],
14+
"logConfiguration": {
15+
"logDriver": "awslogs",
16+
"options": {
17+
"awslogs-create-group": "true",
18+
"awslogs-group": "/ecs/detection-container",
19+
"awslogs-region": "AWS_REGION",
20+
"awslogs-stream-prefix": "ecs"
21+
}
22+
}
23+
}
24+
]
25+
}

0 commit comments

Comments
 (0)