Stop Deploying to ECS Just to See If Your Code Works
Originally published on metalbear.com . On ECS, the usual way to find out whether a change works is to deploy it. You build the image, push it, register a new task definition revision, wait for the rollout and look at what happened, then do it all again if it's wrong. A loop like that might have been tenable for humans, but a coding agent writes a change in seconds, then waits for a full rollout…
A new tool called mirrord for ECS has been introduced to help developers test their code changes without having to deploy them to the production environment. This tool works by running the code on the developer's laptop, CI runner, or sandbox as if it were a live task in the staging environment, with the same network, environment variables, and IAM task role as the deployed service.
Developers can then use their usual development tools to run their code and see the results, without having to wait for a full rollout. This eliminates the need for the traditional process of building the image, pushing it, registering a new task definition revision, and monitoring the rollout. Mirrord for ECS works by adding a small setup container to each service's task definition, which stays in place after deployment.
When the task starts, the setup container loads mirrord into the app container, allowing the code to run with the app's network and environment. The code and the task both connect to a sessions-manager, which relays traffic between them. This allows the local code to reach the private databases, queues, and APIs that the deployed service can access, without opening any new ports.
Developers can choose where the sessions-manager runs, either in their own Kubernetes cluster or in MetalBear Cloud, and authenticate to it using their session key. Once mirrord is set up, developers can run their code locally with the mirrord up command, and send requests with their session header to the service's staging address.
This allows them to see the results of their changes in real-time, without having to wait for a rollout. If there are any issues, developers can simply change the code and run it again, without the need to build or roll out a new version. MetalBear Cloud provides a sample ECS app that demonstrates how to use mirrord with a small service and a private RDS database.
The tool is also available for other platforms such as Lambda, Cloud Run, Vercel, and Cloudflare, and users can request support for additional platforms on their website.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.
- Stop Deploying to ECS Just to See If Your Code Works metalbear.com