# AWS

> Run the Atlantic Agentic Engine on AWS: the stack LightHouse generates, what it creates, the permissions it takes, regions, deployment profiles, and how to remove it.

The engine runs in an AWS account of yours, as Terraform your own GitLab pipeline applies. Models are called through Amazon Bedrock, in your account and region, by the gateway’s role alone. LightHouse never applies anything in your account.

## The stack LightHouse generates

In LightHouse, **Setup and admin → Where agents run**, choose **AWS**, a region and a profile, then **Get my stack**. LightHouse shows the files in full, each with a **Copy** button:

1. **`lighthouse-bootstrap.json`**, a CloudFormation template that a person creates once. **Open your Amazon Web Services console** opens CloudFormation’s create page in your region; upload the template there. It creates the role your pipeline deploys with, the permission boundary every role the stack creates must carry, and the Terraform state bucket. It creates no part of the engine itself.
2. **`main.tf`**, which calls five of Atlantic’s AWS modules, pinned to infrastructure release `v0.7.0` and read from that release’s module package. Commit it to your own infrastructure repository; your pipeline plans and applies it from `main`, as a reviewed merge request.
3. **`handler-commands.yaml`**, your policy for commands from LightHouse, kept beside `main.tf` in the same repository. Every command type is off until you switch it on, and a command runs only if this file and LightHouse both allow it.

| Module                    | What it creates                                                                                                                 |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `aws-client-stack`        | The stack itself: the network, the database, the model gateway and the product’s own service                                    |
| `aws-telemetry-collector` | The telemetry relay, which signs and sends your telemetry. The module name is historical: it is not a [collector](/collectors/) |
| `aws-content-reader`      | The reader that lets you read your own content in place from LightHouse                                                         |
| `aws-handler-commands`    | The command channel: how an approval, a pause, a budget change or a sealed connector credential reaches your deployment         |
| `aws-scheduled-jobs`      | One schedule per card in your catalogue, which is what runs a connector’s sync                                                  |

The last two are what make a deployment answer LightHouse and collect on a schedule. A stack without them has a gateway and a database and no way to be told to do anything.

The template is copied from LightHouse, not linked to a template Atlantic hosts, so Atlantic cannot change what you applied after you read it.

### The bootstrap’s parameters and outputs

| Parameter                       | What to give                                                                                                                |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `GitLabProjectPath`             | The full path of the gitlab.com project that applies the Terraform, for example `your-group/your-infra`                     |
| `ExistingGitLabOidcProviderArn` | Empty, to create gitlab.com’s OIDC provider. An account has at most one per address: if yours already has one, give its ARN |

A rule refuses to create the stack in any region but the one you chose in LightHouse.

| Output                   | Use                                                                                    |
| ------------------------ | -------------------------------------------------------------------------------------- |
| `DeploymentRoleArn`      | Your pipeline assumes it as `AWS_ROLE_ARN`, with GitLab’s ID token as the web identity |
| `StateBucket`            | `terraform init -backend-config="bucket=<StateBucket>"`                                |
| `PermissionsBoundaryArn` | Carried by every role `main.tf` creates; `main.tf` already names it                    |

### What to have ready

- An AWS account for the deployment, with the Bedrock models you want enabled in your region.

- A gitlab.com project whose CI can request an ID token.

- A module access token from Atlantic: a per-tenant, read-only deploy token whose scope is the package registry read only, revocable per client. Your Terraform job reads the modules with it through a netrc file, stored as a masked, file-type CI/CD variable, with `NETRC` set to that variable. The file holds one line, and Atlantic’s stack files say the same in a comment:

  ```text
  machine gitlab.com login <the token's username> password <the token>
  ```

- For `main.tf`’s variables: the account ID; the gateway’s image by digest in your ECR; an image carrying the engine (the gateway image will do) for the relay, the reader, the command channel and the schedules; `source_catalogs`, a catalogue path per pack, which is what the connector tick reads to know which sources are due; the gateway policy (which models, caps and pacing); the Bedrock model IDs; an ACM certificate in your region; the address ranges allowed in; the monthly budget and the addresses for its alerts. Your own product’s image is optional: without it the stack runs the gateway alone.

- For the ephemeral profile, also the gateway’s Lambda image, by digest.

### After the first apply

Terraform creates the empty slots; a person fills them, and Terraform never holds the values:

- `<client>/lighthouse-deployment-key`: the deployment’s Ed25519 private key, made in your account. Only its public half is registered with LightHouse.
- `aal-<client>/content-reader-aal-public-key`: Atlantic’s reader public key. Empty it to stop Atlantic reading.
- `aal-<client>/content-reader-stores`: the read-only database addresses the reader may use.
- Your product’s own secret key, when you set a product image.

Every secret to fill is listed in the `fill_after_apply` output of `main.tf`, by what goes in each.

## What it creates

**Your AWS account**: one region you choose, in a private network (VPC)

Way in

- **Load balancer**, Application Load Balancer, AWS WAF: open to your address ranges only

your people and systems, from your address ranges

Engine

- **Gateway**, ECS on Fargate · AWS Lambda: the only path to a model: policy, caps, kill switch
- **Your product and agents**, ECS on Fargate: runs your agents through the gateway
- **Telemetry relay**, ECS on Fargate · Amazon SQS and a function: signs content-free records
- **Content reader**, ECS on Fargate · a function every minute: answers reads signed by Atlantic
- **Command channel**, ECS on Fargate · a function every minute: applies signed commands your policy allows
- **Connector-schedule tick**, EventBridge Scheduler, an ECS task: every 15 minutes, syncs your sources

model calls, from the gateway's role alone

Models

- **Amazon Bedrock**, in your account and region: a Bedrock guardrail on every call

Kept in your account

- **Secrets**, Secrets Manager, SSM: the deployment key, tokens, connector credentials
- **Database and index**, RDS PostgreSQL · Aurora Serverless v2: the gateway's store and your index
- **Files**, Amazon EFS: the deployment's files
- **Keys**, AWS KMS: one key for data, logs and trail
- **Logs**, CloudWatch Logs, CloudTrail: every content read, recorded

One outbound path, through your NAT, over HTTPS

- **Operational telemetry** (downward): counts, costs and timings from the relay, signed by your deployment. Never content
- **Content, read in place** (both ways): a read signed by Atlantic, answered by your reader on the connection it opened
- **Signed commands** (upward): pause, approve, set a cap: checked by your command channel against your policy

**LightHouse**: your tenant, in Atlantic's account: intake, API, MCP and portal

The stack your pipeline applies on AWS. Every component runs in your account; the gateway's role alone may call Amazon Bedrock; the relay, the content reader and the command channel each dial out to LightHouse, and nothing listens for Atlantic. Where two services are named, the second is the ephemeral profile's.

- Amazon ECS
- AWS Fargate
- AWS Lambda
- Amazon RDS
- Amazon Aurora
- Amazon S3
- AWS Secrets Manager
- AWS Key Management Service
- Amazon CloudWatch
- Amazon VPC
- Amazon ECR
- Amazon Bedrock

Every resource is named `aal-<client>…`, where `<client>` is your organisation’s short name in LightHouse, and tagged.

| Area           | Resources                                                                                                                                                                                                                                                                                                                                    |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Keys           | A KMS key and alias for the deployment’s data, logs and trail                                                                                                                                                                                                                                                                                |
| Network        | A VPC (10.40.0.0/16) with the default security group closed, private and public subnets in two availability zones, and flow logs. Always-on: a NAT gateway and seven interface endpoints (Bedrock, ECR twice, CloudWatch Logs, Secrets Manager, KMS, EFS). Ephemeral: one NAT instance (t4g.nano) instead. An S3 gateway endpoint under both |
| Logs and audit | CloudWatch log groups (400 days); a multi-region CloudTrail with log file validation, into its own bucket                                                                                                                                                                                                                                    |
| Database       | Always-on: RDS PostgreSQL, Multi-AZ. Ephemeral: Aurora Serverless v2, pausing after five idle minutes. Both with deletion protection, 14 days of backups and a final snapshot                                                                                                                                                                |
| Files          | EFS, encrypted with the key, with access points                                                                                                                                                                                                                                                                                              |
| Budget         | An AWS Budget emailing at 80% forecast and 100% actual                                                                                                                                                                                                                                                                                       |
| Secrets        | The gateway’s token and the product’s secret key in Secrets Manager; the gateway policy in SSM, as a SecureString                                                                                                                                                                                                                            |
| Compute        | An ECS cluster on Fargate (ARM64) with service discovery. Always-on: the gateway as two tasks. Ephemeral: the gateway as an AWS Lambda function. Your product, if given, as one task                                                                                                                                                         |
| Edge           | An internet-facing Application Load Balancer with deletion protection and a web firewall, open to your address ranges only                                                                                                                                                                                                                   |
| Guardrail      | A Bedrock guardrail on every model call                                                                                                                                                                                                                                                                                                      |
| Telemetry      | The relay, which signs content-free records with the deployment’s key and sends them to LightHouse. Always-on: an ECS service beside an OpenTelemetry Collector that also sends content-free traces to X-Ray in your account. Ephemeral: an encrypted SQS queue and a relay function, with no X-Ray traces                                   |
| Content reader | The read-only reader, which dials out to LightHouse and answers only reads signed with Atlantic’s reader key; every read is logged in your account. Always-on: an ECS service. Ephemeral: a function started every minute                                                                                                                    |

**The command channel, the connector-schedule tick and the sealing key are in the generated stack**. `main.tf` adds the command channel (`aws-handler-commands`, with a prefix in Secrets Manager for connector credentials in your own account) and a job that runs the connector-schedule tick every 15 minutes. A new file beside it, `handler-commands.yaml`, is your deployment’s policy, with every command type off until you switch it on. The command key from Atlantic, the channel’s store URL and the sealing key are filled in after the apply, the sealing key made in AWS CloudShell in your own account.

## Permissions

### The deployment role

The bootstrap creates one role, `lighthouse-deploy-<tenant id>`, that only your GitLab project’s `main` branch can assume (a merge request’s pipeline cannot), for at most an hour. No long-lived key exists. It holds AWS’s `PowerUserAccess`, which allows no IAM, and one policy of its own:

| Statement                       | Effect                                                                                                                                                                                                            |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| One region only                 | Denies anything outside your region, except the global services the stack calls: IAM, STS, Budgets (the account budget), Route 53 (service discovery’s private zone), and Organizations’ and Support’s read calls |
| The stack’s roles and no others | Allows managing and passing IAM roles named `aal-<client>-*`, and the instance profile of the same name, and nothing else in IAM                                                                                  |
| Every role carries the boundary | Denies creating a role, or setting a boundary, without the bootstrap’s permission boundary; removing a boundary is denied outright                                                                                |
| Never itself                    | Denies any IAM action on its own role or on the boundary                                                                                                                                                          |
| The state stays                 | Denies deleting the state bucket or changing its policy or versioning                                                                                                                                             |
| No users, no keys               | Denies creating IAM users, access keys or console passwords, and leaving the organisation                                                                                                                         |
| The trail stays                 | Denies stopping or deleting any CloudTrail trail but the stack’s own                                                                                                                                              |

**The permission boundary**, `lighthouse-boundary-<tenant id>`, allows the workload what its own policies give it and denies all of IAM, Organizations and Account. So no role the pipeline creates can do more in IAM than the pipeline itself.

The template grants Atlantic no access to your account. Atlantic cannot assume the role.

### The workload’s roles

| Role                                          | Holds                                                                                                                               |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Gateway (the only role that may call a model) | `bedrock:InvokeModel`, `InvokeModelWithResponseStream`, `Converse` and `ConverseStream` on the listed models only; `ApplyGuardrail` |
| Product                                       | No Bedrock at all. On the ephemeral profile, invoking the gateway’s function, and nothing else of it                                |
| Relay, reader                                 | Each its own role, reading its own secrets                                                                                          |

Setting `models_enabled = false` attaches an explicit deny on `bedrock:*` to the gateway’s role: a second kill switch, below the gateway’s own. See [Suspension](/operations/suspension/).

## Regions

LightHouse offers eu-west-1 (the default), eu-west-2, eu-central-1, us-east-1 and us-west-2. The bootstrap must be created in the region you chose, its role is denied every other region, and `main.tf` pins every resource, the endpoints and the model calls to it. Global cross-region inference profiles are refused. See [Regions](/data-sovereignty/regions/).

## Deployment profiles

The modules default to `always_on`; LightHouse proposes `ephemeral`, and writes the profile you chose into `main.tf`.

|                                                       | Always-on (`always_on`)               | Ephemeral (`ephemeral`)                                                                                                   |
| ----------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Gateway                                               | Two Fargate tasks, always warm        | A Lambda function (ARM64) behind a function URL with IAM authentication; the product reaches it through a local forwarder |
| Relay                                                 | Two Fargate tasks, with the collector | A queue and a function; no X-Ray traces                                                                                   |
| Content reader                                        | A Fargate task holding its connection | A function every minute; a read waits up to about a minute while it wakes                                                 |
| Database                                              | RDS PostgreSQL, Multi-AZ              | Aurora Serverless v2; about 15 seconds to resume after a pause                                                            |
| Network                                               | NAT gateway and interface endpoints   | One NAT instance                                                                                                          |
| Product                                               | One task                              | One task                                                                                                                  |
| Estimated saving on the lines that differ (eu-west-1) | —                                     | around 95%                                                                                                                |

The estimated saving on those lines is around 95%, from the modules’ cost model at list prices before credits and free tiers. It is given as a proportion because the amount depends on your region, your currency, any committed-use or reserved pricing and the size you run. Your own figures appear in LightHouse once your deployment reports its infrastructure cost. The lines both profiles share (the load balancer, the product, EFS, the key, logs, the trail, secrets) are left out of both, so it is understated.

To switch, change `deployment_profile` (and, for ephemeral, add `gateway_lambda_image`), then plan and apply. No data moves: the key, the database, the file system and the secrets are kept. `main.tf` sets the database and network to suit the profile it was generated for; changing the database is a separate migration. See [Deployment profiles](/concepts/deployment-profiles/).

Scheduled (`scheduled`, with `wake_schedule`) is built as ephemeral, and inside its [wake window](/concepts/deployment-profiles/#the-wake-window) Application Auto Scaling scheduled actions, in the window’s time zone, keep provisioned concurrency on the gateway function so it answers at once. Switching from ephemeral to scheduled publishes a function version behind an alias, so the function URL’s address changes; the forwarders take the new address in the same apply.

## Upgrading and removing the stack

- **Upgrade**: change the release version in the module package’s address (`https://gitlab.com/api/v4/projects/<atlantic-project>/packages/generic/lighthouse-modules/<version>/lighthouse-modules.tar.gz`), changed by getting the stack again for the new release, in a reviewed merge request. Images are pinned by digest. See [Upgrades](/operations/upgrades/).
- **Remove**: see Remove my stack, below.

### Remove my stack

As a client administrator, open **Setup and admin → Run → Remove my stack**. LightHouse generates a step-by-step guide (`lighthouse-removal.md`) and a pipeline job file (`lighthouse-removal.gitlab-ci.yml`) for this stack. It changes nothing itself, and nothing runs automatically: the jobs are manual, run on your main branch only, and refuse to run until the CI/CD variable `LIGHTHOUSE_REMOVE` names the deployment.

1. **Lift deletion protection**, in an apply of its own. The database and the load balancer are protected, and the job lifts both before anything is destroyed. It refuses any plan that does more than that, and reads the load balancer’s protection back from AWS before it goes on, because a destroy that meets the protection stops half way with the services already gone.
2. **Destroy** the stack with `terraform destroy`.
3. **Delete the bootstrap**, a person’s step: its CloudFormation stack. The state bucket is kept until a person empties and deletes it.
4. **Deregister in LightHouse**, a person’s step.

Deregistering is the last step. You sign in as a person with a second factor (a machine key or a delegated token is refused), type the deployment’s name again and give a reason. LightHouse then refuses the deployment’s signatures from that moment and records it in the audit log. Only Atlantic can reinstate it, within 30 days.

Source: https://docs.atlanticagenticlabs.com/where-it-runs/aws/
