The Simplest Way to Make AWS CloudFormation and Selenium Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use aws cloudformation and selenium to build fresh cloud stacks and run browser tests. CloudFormation builds the servers and networks, while Selenium tests the web app right away. This workflow stops teams from testing on old, broken servers. Each code push gets a clean stack and a full set of browser checks. When the tests finish, the template deletes the servers to save money. You get fast feedback without paying for idle test machines all day. How roles and data move between aws clou

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 aws cloudformation and selenium to build fresh cloud stacks and run browser tests. CloudFormation builds the servers and networks, while Selenium tests the web app right away.

This workflow stops teams from testing on old, broken servers. Each code push gets a clean stack and a full set of browser checks. When the tests finish, the template deletes the servers to save money. You get fast feedback without paying for idle test machines all day.

How roles and data move between aws cloudformation and selenium

First, your build tool asks AWS to create a new stack from a template. This template sets up networks, web servers, and browser nodes for testing. CloudFormation uses a scoped cloud role to build these parts on its own. Once the stack is ready, it outputs the new web app link.

Next, the test runner reads that link and starts the browser checks. Selenium sends commands to the browser nodes inside the new cloud network. The browser loads the web app, clicks buttons, and checks the page text. Test logs and screenshots go straight to a storage bucket for the team.

Permissions must stay tight at every step of this flow. The template role only needs rights to create and delete the test stack. The browser nodes only need network routes to reach the test web app. When the run ends, the build tool tells AWS to delete the stack.

Common failures and how to scope roles and networks

Many teams make the mistake of using one broad cloud key for everything. If a test script leaks that key, an attacker can reach production data. Shared accounts also make it hard to see who started a test run. Unlogged database checks during a test can hide bad queries or data leaks.

Another common issue is leaving browser nodes open to the public web. Anyone who finds the open port can run code on your test servers. Teams also forget to clean up failed stacks after a test crashes. Those leftover servers keep running and drive up your monthly cloud bill.

AWS IAM Policies + CloudFormation Guard: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these problems with strict role and network rules. Give the stack builder a role that only touches test resources. Put the browser nodes and the test app in a private subnet. Allow network traffic only between the test runner, the browsers, and the app.

Keep test logins out of your stack templates and code files. Store test user passwords in a secret store and read them at runtime. Set a stack timer so AWS deletes old test servers after two hours. Mask sensitive fields like emails, phone numbers, and card numbers in test logs.

Running fast browser checks on clean cloud stacks

Speed matters when developers wait for test results on a pull request. Slow stack builds will make your team skip browser checks to save time. You can speed things up by using pre-built machine images for browser nodes. Those images already have the browser and driver files installed and ready.

Split your template into a base network stack and an app stack. Keep the base network up all day so you do not wait. Spin up only the app servers and browser nodes for each new test. This cut in build time keeps your feedback loop short and reliable.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Should I build a new browser grid for every test run?

Building a grid per run works well for small teams who run few tests. Busy teams often share one private grid and spin up only the web app.

How do I pass the new app URL to my test scripts?

Use stack outputs to save the web address when the build finishes. Your build runner can read that output value and pass it to the test tool.

How can I stop failed test runs from leaving cloud servers running?

Set a rollback rule and a stack timeout when you start the build. The cloud provider will then delete the resources if the test hangs or fails.

The query runs. The emails stay hidden.