Urgent.News

What's breaking now, across thousands of outlets.

Tech

Running ECS Workloads on Bare Metal with Spinifex

ECS is the part of the AWS stack that teams reach for when they want container orchestration without the complexity surface of Kubernetes. A cluster, some task definitions, a service, and a load balancer, and the scheduler handles placement and restarts. The problem is that ECS is deeply tied to AWS. The scheduler is a managed service, the container instances are EC2 instances, and the whole…

ECS (Elastic Container Service) is a container orchestration tool within AWS that enables users to run containerized applications without the complexity of Kubernetes. However, ECS is tightly integrated with AWS and requires a live connection to amazonaws.com. Spinifex offers a solution to run ECS on bare metal, disconnected environments, and behind custom network boundaries.

Spinifex works by following the EC2 launch type model directly, where users supply the compute resources needed. A cluster is a logical grouping of these compute resources, and the capacity behind it is provided by container instances, which are ordinary EC2 instances running the Spinifex ECS agent. The agent registers these instances with the cluster, reports their available CPU and memory, and runs the containers placed on them by the scheduler.

Using Spinifex, tasks are defined with one or more containers, including image, CPU and memory limits, port mappings, environment variables, and an optional task IAM role. A service keeps a desired count of tasks running, replaces any failed tasks, and registers each task's IP with an ALB target group if a load balancer is present.

To use Spinifex, users must first ensure that the Spinifex ECS node image is imported into their AWS account. They also need to attach the ecsInstanceRole instance profile to container instances, which provides the necessary permissions for the ECS agent. The Spinifex console can automatically create this role if necessary.

Creating a cluster and registering a task definition involve exporting the AWS profile, creating the cluster, and then registering the task definition. The AWS CLI commands for these actions are provided in the source material. Container instances can be provisioned by launching EC2 instances from the ECS node image with the ecsInstanceRole profile attached. The agent on these instances is configured to point to the cluster name using cloud-init user data.

To run a task or create a service, specific AWS CLI commands are provided. If a task needs to call AWS APIs, a taskRoleArn must be specified in the task definition, allowing the ECS agent to inject temporary AWS credentials into the container. Logging within Spinifex is similar to ECS, with container stdout and stderr written to the container instance's journal, which can be inspected using tools like `ctr` and `journalctl`.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Your Coding Agent Just Joined the Group Chat

Slack just made your coding agent a team member. Not a tool. Not a CLI command. A full participant in your group chat that spins up its own channel, writes code in the open, and archives itself when…

More from Friday 28 August →