> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truthsystems.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy on AWS

> Deploy Gateway to your AWS account.

At a high level, Gateway on AWS is a Step Function which invokes multiple lambdas, which in turn run models on Bedrock and use DynamoDB for caching.

## Prerequisites

* AWS account with permissions to create the resources mentioned above
* [Terraform](https://www.terraform.io/)
* The Gateway Terraform module (provided via SFTP during onboarding)
* Access to our ECR registry (provided during onboarding)

## Quick start

```bash theme={null}
# Unzip the Terraform scripts from SFTP
unzip aws.zip
cd aws

# Configure your deployment
# For a full list of variables, see variables.tf
cat > terraform.tfvars <<EOF
region = "us-east-1"
EOF

# Deploy
terraform init
terraform apply
```

After deployment, Terraform outputs the Step Function ARN:

```
state_machine_arn = "arn:aws:states:us-east-1:123456789:stateMachine:yourprefix-gateway"
```

Use this ARN to configure the SDK.

## IAM permissions

Callers need permissions to invoke the Step Function and check execution status:

```json theme={null}
{
  "Effect": "Allow",
  "Action": ["states:StartExecution", "states:DescribeExecution"],
  "Resource": [
    "arn:aws:states:REGION:ACCOUNT_ID:stateMachine:STATE_MACHINE_NAME",
    "arn:aws:states:REGION:ACCOUNT_ID:execution:STATE_MACHINE_NAME:*"
  ]
}
```

Replace `REGION`, `ACCOUNT_ID`, and `STATE_MACHINE_NAME` with values from your deployment.

## Monitoring

Gateway logs to CloudWatch by default. We have configured it so that the logs are helpful for debugging scaling issues. In particular, the step function executions can be fully visualized by visiting the AWS console.

Logs expire after a period that you can set.
