openfeature_provider = "flagd". Obtain a Distribution reader key registered for this deployment from Runlayer before applying. The module’s application default is still WorkOS; setting only the Distribution key and URL does not switch providers.
Quick Start
1. Create the root configuration
Create a working directory and save the following asmain.tf. Replace the account, hostname, parent hosted zone, state bucket, auth client ID, and company details. Pin the module release agreed with Runlayer; this example uses v49.0.0, the first release that reads the WorkOS, Sentry and Resend keys only from the provisioned tenant secret and has no auth_api_key input. See the Terraform changelog for its default app version.
aws and aws.route53, including when DNS lives in the same account. Cross-account DNS also needs the DNS role and zone ID described in networking.
For a new deployment, also set redis_engine = "valkey" (module v49.0.0 or later) so the cache runs Valkey 9.1. See Redis / ElastiCache.
Terraform marks only five module inputs as required because they have no defaults. This guide also requires the catalog credential and the registered Distribution reader key. The WorkOS API key is not an input: Runlayer writes it to the provisioned tenant secret restricted/<project>-<env>-provisioned in your account before your first apply, and the plan fails until that secret exists (see Secrets management). Confirm outbound HTTPS to distribution.prod.runlayer.com before startup. Add your selected database, network, security, and optional-feature inputs to this configuration before continuing.
2. Supply credentials
Keep the AWS credential environment from prerequisites. Provide the secret inputs through your secret manager or environment. For an interactive Bash shell, these prompts avoid putting values in shell history:.terraform/, *.tfstate*, *.tfplan, or files containing secrets. Commit .terraform.lock.hcl after initialization.
3. Initialize, validate, and plan
Before planning, review the selected module’s provisioners. Sentry Relay is enabled by default and reads its credentials from the provisioned tenant secret at task start; no external program runs during the plan (see Sentry Relay credentials).local-exec provisioners run during resource creation/destruction, not an ordinary
plan.
terraform init -upgrade to update the lockfile before planning.
4. Apply
anysource-backend-migration-logs-<project>-<environment>. The migration wait defaults to 30 minutes.
This example sets wait_for_ecs_steady_state = true; the module default is false. Even with waiting enabled, complete the checks below: infrastructure readiness does not prove login or connector workflows work.
Verify
Run these commands from the root configuration directory, with the same AWS profile and region:COMPLETED. The AWS waiter has its own timeout; a timeout requires inspecting events and logs. For a private ALB, run HTTP checks from a machine with the required private routing and DNS.
Then verify the user journey:
- Open
terraform output -raw application_url, confirm TLS is valid, and sign in through the configured SSO/WorkOS flow. - Confirm the MCP catalog loads. A catalog
503can indicate a missing API key;401can indicate a wrong key or catalog URL. - Configure an approved test connector, connect an MCP client, and make a harmless tool call. Confirm its session/audit record appears.
- Exercise each feature you enabled: an agent run, ToolGuard scan, or AI Watch package discovery, as applicable. Confirm optional services and load-balancer targets are healthy too.
Troubleshooting
Module or image access denied
Forterraform init, confirm the deployment identity can read the versioned archive in runlayer-infrastructure-modules. For CannotPullContainerError, check ECS events, ECR access to account 088332244652, and the ECR/S3 network paths. Contact Runlayer support if onboarding access is missing.
Migration task failures
anysource-backend-migration-logs-ecs-production for the example configuration, or use your actual project and environment.
Check the migration task’s stopped reason, database connectivity, image permissions, and the AWS CLI credentials inherited by Terraform. After correcting the cause, review a new plan before applying again. Do not disable state locking or force-unlock while another run may still own the lock.
If the migration fails on lock timeout, search the log for migration_lock_timeout_snapshot. After each timed-out attempt, it lists up to 10 sessions with the oldest open transactions that hold table locks: pid, user, application name, client address, state, transaction age, wait event, and up to 10 locked tables with each lock mode (lock_count is the total). These are likely blockers at the moment the attempt failed, not a verified blocking chain, so confirm a session is still running and safe to end before you end it. If the migration’s database role lacks pg_read_all_stats, other roles’ sessions are listed first with details_hidden: true and their activity fields empty; look them up by pid as a privileged user.
If the migration keeps failing on lock timeout, give it a longer wait for one deploy: if migrations starve on lock contention, set migration_escalated_lock_timeout_ms = 120000 (default 30000) in your deployment root for the upgrade. Raise it rather than migration_lock_timeout_ms, which applies to every attempt. If you previously raised migration_lock_timeout_ms (for example to 120000), restore it to 5000 when you set the escalated timeout: 20 base attempts at 120 seconds can take 40 minutes, longer than the 30-minute backend_migration_wait_timeout_seconds. Also keep migration_retry_count at or above migration_base_tier_attempts + migration_escalated_tier_attempts (default 25); a lower value stops the runner before it reaches the escalated attempts (with migration_retry_count = 1, it makes only two base attempts).
Some migrations set their own lock_timeout, which overrides these inputs for that migration: its attempts fail after the migration’s timeout, sooner than the lock_timeout_ms in the migration_start log line, and raising the inputs does not help. If a migration keeps failing that way, send the failing revision and SQLSTATE (55P03 for a lock timeout) to your Runlayer Slack channel or support@runlayer.com. For a diagnosed ECS or RDS service issue, the AWS account owner can open a case in the AWS Support Center. See support boundaries.
Application not accessible
DomainValidationOptions and verify its exact CNAME name and value in authoritative DNS.
Login works but optional features fail
Check egress symptoms, Bedrock access, and your feature’s configuration. AgentCore behind WAF needs the private network path; ToolGuard needs working GPU bootstrap and capacity.Next Steps
- Updates and rollback
- Backup and restore
- ECS configuration and operations
- Terraform inputs reference
- Module changelog
Related configuration
The following sections retain their existing links and point to the focused guides.Prerequisites
See ECS prerequisites.Private connection provisioning
See private connection provisioning. Connection configuration revision2 is separate from module releases such as v49.0.0.