ECS Managed Instances and Daemons
The ecs-managed-instances target is in early access. Contact support to enable it for your
organization.
The ecs-managed-instances target runs a service on Amazon ECS Managed Instances: EC2 instances that AWS launches, patches, scales, and replaces for you. You describe the vCPU and memory each instance needs, and AWS picks matching instance types.
Managed Instances also run ECS managed daemons. A daemon runs exactly one task on every instance of the service. ECS starts it before any of your app’s tasks on that instance, and if a critical daemon stops, ECS drains and replaces the instance. This is how you run host-level agents such as security sensors, log shippers, and monitoring agents.
Configuration
{
"id": "api",
"name": "API",
"type": "web",
"cpu": 2,
"memory": 4,
"target": {
"type": "ecs-managed-instances",
"instanceRequirements": {
"vcpu": {"min": 4, "max": 16},
"memory": {"min": 8, "max": 64}
},
"storage": 100,
"daemons": [
{
"name": "falcon-sensor",
"image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/falcon-sensor:7.20.0",
"cpu": 0.25,
"memory": 0.5,
"privileged": true,
"pidMode": "shared",
"ipcMode": "shared",
"volumes": [{"hostPath": "/opt/CrowdStrike", "containerPath": "/opt/CrowdStrike"}],
"environment": {"FALCONCTL_OPT_CID": "YOUR-CID"},
"critical": true
}
]
}
}Your service’s cpu and memory can be any values that fit on an instance. They don’t need to match a Fargate size.
Daemon fields
| Field | Default | Description |
|---|---|---|
name | required | 1 to 64 letters, numbers, - and _. Unique within the service. |
image | required | The container image. Private ECR images in the same account work without extra setup. |
cpu | 0.25 | vCPU reserved for the daemon on each instance |
memory | 0.5 | Memory in GB reserved for the daemon on each instance |
privileged | false | Gives the container all Linux capabilities |
linuxCapabilities | {"add": [...], "drop": [...]} for individual capabilities instead of privileged | |
pidMode | none | shared joins the host’s process namespace, so the daemon can see every process on the instance |
ipcMode | none | shared joins the host’s IPC namespace |
volumes | [] | Host directories to mount: {"hostPath", "containerPath", "readOnly"} |
environment | {} | Environment variables for the daemon container |
command | Overrides the image’s command | |
critical | false | When true, ECS drains and replaces an instance whose daemon stops |
Daemon logs go to the CloudWatch log group /ecs/<cluster>-daemons with the stream prefix daemon-<name>.
How deploys work
On each deploy, Flightcontrol updates the daemons before it updates your app:
- A new daemon is created on the service’s capacity provider.
- A changed daemon gets a new revision. ECS rolls it out by draining and replacing instances, so changing a daemon replaces your service’s instances in batches.
- An unchanged daemon is left alone, so app-only deploys don’t replace instances.
- Changes to
instanceRequirementsandstorageupdate the capacity provider. Instances launched after the deploy use the new settings. - Preview environments share one cluster across their PRs, so a PR deploy only creates missing daemons. It doesn’t change or delete daemons or the capacity provider’s settings.
- A daemon removed from the config is deleted.
Flightcontrol names its daemons fc-<name> and only changes daemons with that prefix. Daemons you create yourself in the service’s cluster are left alone.
Managed Instances services always run in your environment’s private subnets, so the environment gets a NAT gateway. GPUs are not supported.
Moving an existing Fargate or ECS on EC2 service
Change the service’s target.type from fargate or ecs-ec2 to ecs-managed-instances and deploy. The service keeps its load balancer, domains, and service discovery names. During that deploy, Flightcontrol:
- Checks that the environment has private subnets and a NAT gateway. The environment deploy creates them once a service uses Managed Instances.
- If the service runs in public subnets, moves it to private subnets with a rolling deployment, then continues. New tasks start in the private subnets and pass their health checks before the old ones stop, so the service stays up. If the new tasks can’t start there, for example because they can’t reach the internet through the NAT gateway, or the move takes longer than 25 minutes, the deploy fails with the reason while the old tasks keep serving traffic. Fix the cause and deploy again.
- Creates a Managed Instances capacity provider in the service’s cluster.
- Deploys the service onto Managed Instances with a rolling deployment. If the deployment fails, the service goes back to Fargate or its EC2 instances.
- For an ECS on EC2 service, scales its Auto Scaling group to zero and terminates each old instance once its tasks have drained.
Moving back to Fargate or ECS on EC2, and moving preview environment or blue/green services are not supported yet.