lmweblab guide

Dual-engine architecture, two-phase HTTP and HTTPS verification, 12-scenario catalog, and security guardrails for lmweblab.

Overview

lmweblab validates and compares two independent infrastructure engines implemented in lmscript: Part A using the native lmaws host (Cloud.web_stack and Serverless builders) and Part B using the OpenTofu-backed lmcloud host. Both engines deploy functionally identical tagged AWS web architectures, run the same lmcurl HTTP contract and p95 latency tests, render architecture and latency diagrams with lmdraw and lmplot, and prove zero leftover resources in an independent post-teardown audit.

Base web stack and two-phase lifecycle

The core stack combines a static delivery path and a dynamic compute path under a single run identifier:

# Run Part A offline through Phase 1 and Phase 2, then verify recipes
lmctl lmaws/web_stack.lms all --offline --phase2
lmctl lmaws/test_recipes.lms
lmctl lmaws/report.lms

Importable step recipes

In addition to the monolithic web_stack.lms lifecycle driver, lmaws/recipes/steps.lms exposes granular provisioning functions (web_bucket, web_certificate, web_distribution, web_site_dns, web_compute, web_app_dns, web_https, and web_invalidate) that can be imported locally or via a raw GitHub URL. Passing live: false runs a deterministic, credential-free preview; preparing web_certificate before web_distribution attaches the validated custom alias at distribution creation time and avoids a second CloudFront deployment wait.

12-scenario cloud and serverless catalog

Under scenarios/01..12, lmweblab expands into twelve focused architectural patterns, each providing up.lms, test.lms, down.lms, status.lms, and all.lms entry points:

Isolation, ownership tags, and cost guardrails

Offline runs are the default gate in CI and local development: they use deterministic synthetic transports, test the actual Python user-data server and Lambda handlers on loopback through lmcurl, always run teardown, and cost $0.00. Always run scenario tests in isolated temporary copies via bash test.sh or scenarios/test-lmaws.sh so fixture runs never collide with active deployment state.

Live runs enforce strict guardrails in both the scripts and the native lmaws host: mutations require AWS_PROFILE=lmaws, us-east-1, and LMWEBLAB_LIVE=1; resource names must match the run-scoped lmaws-site-<run>, lmaws-app-<run>, or lmaws-tf-<run> prefixes; taggable resources carry lmaws_test=<run>; and estimated run costs are capped at $0.10 by default ($0.25 hard ceiling). For Lambda scenarios (03–10), down.lms invokes Serverless.settle(900) to allow delayed CloudWatch log delivery to settle before deleting log groups and running the final zero-leftover audit.