Skip to main content
This guide deploys Runlayer into your AWS account. Start with the ECS overview and complete ECS prerequisites, including Runlayer credentials, AWS identity, state storage, DNS, egress, and Bedrock access. The example creates a new VPC, a public HTTPS load balancer, Aurora PostgreSQL, and ElastiCache Redis. For existing infrastructure or private access, select the networking and configuration inputs before applying. This guide explicitly selects Distribution-backed feature flags with 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 as main.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 v33.1.0, whose default app version is 1.28.1078.
Always pass both 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. 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. 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:
Do not commit .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 external programs and provisioners. Sentry Relay is enabled by default and its external data source can authenticate with your WorkOS API key and read Relay secrets during the plan. Confirm this credential use and runner access first; see Sentry Relay Vault integration. local-exec provisioners run during resource creation/destruction, not an ordinary plan, while external data sources can run during planning or be deferred to apply.
Review the plan’s account, region, network, public/private access, database/cache configuration, optional resources, and cost implications. Resolve errors before applying. A saved plan contains sensitive data even when terminal output redacts it. For an existing deployment with an older provider selection, review the module changelog and use terraform init -upgrade to update the lockfile before planning.

4. Apply

The module runs a separate ECS migration task and waits for it to succeed before rolling out application services. Migration logs are in 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:
Check that there are no service lookup failures, running counts match nonzero desired counts, pending counts are zero, and the primary deployments show 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:
  1. Open terraform output -raw application_url, confirm TLS is valid, and sign in through the configured SSO/WorkOS flow.
  2. Confirm the MCP catalog loads. A catalog 503 can indicate a missing API key; 401 can indicate a wrong key or catalog URL.
  3. Configure an approved test connector, connect an MCP client, and make a harmless tool call. Confirm its session/audit record appears.
  4. 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.
A reachable login page alone is not a successful deployment.

Troubleshooting

Module or image access denied

For terraform 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

If the first apply failed before root outputs were saved, substitute 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.

Application not accessible

Check DNS, ACM certificate status, ALB security groups/WAF, and target health in the EC2 load balancer console. For failed ACM validation, inspect the certificate’s 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

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 revision 2 is separate from module releases such as v33.1.0.

Private CA certificates

See private CA certificates.

Distribution configuration

See Distribution configuration.

Delivery details

See artifacts and versions and Updates.

Configuration options

See ECS configuration, networking, and optional features.

Secrets management

See secrets management.

Module outputs (attributes)

See module outputs.

Naming constraints

See naming constraints.

Required inputs

See the onboarding checklist and inputs reference.

Optional configuration

See configuration and optional features.

Optional services

See agents and other optional services.

Terraform module (S3)

See artifacts and versions and Updates.

Container images (ECR)

See images and versions. Image overrides are described in Updates.

Deployment

Follow Quick Start, then Verify.

Automated database setup

See the migration and startup sequence.

Overview

See the ECS overview.

Architecture

See Architecture.

Cost estimation

See capacity and cost.

Common use cases

See configuration examples.

Private enterprise deployment

See private access choices.

High availability production

See high availability configuration.

Development environment

See development configuration.

ECS vs EKS: which to choose?

See Deployment Overview.