The Simplest Way to Make ECS and Selenium Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use ecs and selenium to run automated browser tests in isolated cloud containers. Amazon Elastic Container Service starts and stops browser nodes on demand for test suites. This setup removes the need to patch and maintain fixed test servers by hand. You can run hundreds of browser tests at the same time during each deploy. When the tests finish, the container service shuts down the extra browser tasks. How ecs and selenium handle permissions and data flow In a standard setup, a test ru

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use ecs and selenium to run automated browser tests in isolated cloud containers. Amazon Elastic Container Service starts and stops browser nodes on demand for test suites. This setup removes the need to patch and maintain fixed test servers by hand. You can run hundreds of browser tests at the same time during each deploy. When the tests finish, the container service shuts down the extra browser tasks.

How ecs and selenium handle permissions and data flow

In a standard setup, a test runner sends commands to a central hub container. The hub routes those browser commands to worker tasks that hold Chrome or Firefox. Each container task runs with its own cloud role to pull images and write logs. The hub task discovers new browser nodes through private network records inside the cluster. Test scripts then drive the browser to load web pages and check page output.

Identity flows along two separate paths in this design. First, the container service uses an execution role to fetch images and start tasks. Second, the running task uses a task role to store test videos and logs. Browser nodes also need credentials to log in to the staging app under test. Teams often fetch those test user credentials from a secret store at task start. All network traffic stays inside a private subnet between the hub and the nodes.

Common failure modes and how to scope roles

Many teams give every browser task a single shared role with broad cloud permissions. If a test loads an untrusted script, that script can read other cloud resources. Shared test user accounts also make it hard to trace which run changed data. Another common issue happens when teams open the hub port to the public internet. Anyone who finds the open hub can run browser commands inside your private network.

Unlogged test runs create blind spots during incident reviews. When a test fails or leaks data, teams need clear logs of every action. Without task-level logs, you cannot tell which test suite touched a staging database. Browser containers can also hang and stay running when a test script crashes mid-run. Those stuck tasks waste compute budget and hold onto active sessions in your app.

You can fix these risks by scoping roles and network paths with strict rules. Give the hub task and the browser nodes separate roles with narrow permissions. The browser node role should only write test artifacts to one specific storage bucket. Lock down security groups so nodes only accept traffic from the hub container port. Set a strict time limit on each task so stuck browsers shut down fast.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing test secrets and live debug sessions

Even with clean roles, engineers still need to debug failed browser tests in production. Teams often enable remote desktop ports on browser nodes to watch live test runs. Leaving those visual debug ports open across the network creates a major security risk. Engineers also tend to hardcode staging passwords inside test code to save setup time. Those static passwords end up in build logs and source control where anyone can read them.

Treat every test container and debug port like a sensitive production server. Store all test login keys in a managed secret store and rotate them often. Redact sensitive fields like emails, phone numbers, and card numbers from test output logs. When an engineer needs to inspect a running container, require a short-lived login session. Close the debug port as soon as the engineer finishes checking the broken test.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How should browser nodes get login keys for the app under test?

Store test account keys in a cloud secret manager and grant the task role read rights. The test runner fetches the secret into memory when the test suite starts up.

Should the hub and browser nodes run in the same task definition?

Keep the hub and browser nodes in separate task definitions so they scale alone. This lets you run one hub task while scaling browser nodes up and down.

How do we stop browser containers from running out of memory?

Give each browser container enough shared memory in the task settings and run one session per task. Stop and replace the container task after each test file finishes its run.

The query runs. The emails stay hidden.