Prerequisites
AWS Account & CLI- An AWS account.
-
AWS CLI v2 installed and configured (
aws configure) with credentials that can deploy CloudFormation stacks.
IAM Permissions
Copy the following JSON file of permissions: permissions.json Before you can deploy any of the CloudFormation stacks above, you’ll want a single, least‑privilege managed policy that your CI/CD user or role can assume.Create the IAM policy
Attach it to your deploy principal
a) If you use an IAM User:Once attached, that user or role will have exactly the rights needed to stand up all of the VPCs, ECS/Fargate clusters, ECR repos, Secrets Manager secrets, ALBs, CloudWatch Logs, IAM roles, and CloudFormation stacks in this guide
Set up ECR (Elastic Container Registry) Repositories for Phoenix and your application
Before deploying Phoenix and your application into ECS/Fargate, you need to host your container images in Amazon Elastic Container Registry (ECR). Here’s a quick rundown:1. Create ECR repositories
Run these once:2. Authenticate Docker to ECR
3. Push Phoenix and your apps (backend, frontend, db)
If you’ve built locally:Create VPCs and Subnets
Copy this CloudFormation template: phoenix-network.yml This template:- Creates a VPC (10.0.0.0/16 for example) with DNS support
- Provisions two public subnets (one per AZ) for your Internet‑facing components (ALBs, NAT gateway)
- Provisions two private subnets (one per AZ) for your ECS tasks (Phoenix, agents, backend services)
- Deploys a NAT Gateway in the first public subnet so private tasks can reach out (for secrets, Docker registries, external APIs)
- Exports the VPC ID and the comma‑separated Public/Private Subnet IDs for easy consumption by downstream stacks
Deploy with:
Extending for multiple components
If you plan to run multiple services (e.g. a separate frontend, backend, worker pool), consider:- Additional subnets You might carve out extra AZ‑distributed subnets (e.g. “app‑subnets”, “db‑subnets”) with their own route tables and security rules.
-
Security groups per tier
- ALB SG: allows inbound HTTP(S) from 0.0.0.0/0
- App SG: allows inbound from the ALB SG on your HTTP port
- DB SG: allows inbound only from your App SG on your database port
Deploy Phoenix (with Authentication)
Copy this CloudFormation template: phoenix-auth.yml You are now ready to deploy Phoenix to AWS. Deploy thephoenix-auth.yml stack
Consume the network stack’s outputs (VPC‑ID, PublicSubnetIds, PrivateSubnetIds) along with your new ECR URI:
- In your browser, go to
$PHOENIX_URL. - Sign in as
admin@localhost/admin. - Set a new admin password.
- Go to Settings → API Keys and Create System Key.
- Copy the new key (you’ll need it in the next step).
0.0.0.0/0 on port 80). You should tighten it if you know your CIDR or are behind a corporate proxy.
Store Phoenix API Key + other API Keys
Once you have your Phoenix System API key, bundle it (and any other service keys) into AWS Secrets Manager:PhoenixArn, OpenAIArn, etc., parameters.
Deploying your App that ships Spans to Phoenix
Copy this CloudFormation template: app.yml This CloudFormation stack (app.yaml) launches:
- An ECS Cluster
- An IAM Task Execution Role & Task Role (to pull images, read secrets)
- A Security Group that allows outbound Internet access
- A Log Group for container logs
- An ECS Task Definition (family:
app) - An ECS Service (Fargate) running one copy of the “app” container
- Read your OTLP endpoint and Phoenix API key from Secrets Manager
- Read your other API keys from Secrets Manager
- Emit spans to your Phoenix deployment
| Parameter | Description | Example |
|---|---|---|
| AgentImageUri | ECR URI (with tag) of your agent container | 123456789012.dkr.ecr.us-west-2.amazonaws.com/agent:latest |
| PhoenixHost | DNS name (no scheme) of your Phoenix UI load‑balancer | phoenix-auth-ALB-abc123.us-west-2.elb.amazonaws.com |
| VpcId | Your VPC ID | vpc-0abc123def456ghi7 |
| PublicSubnetIds | Comma‑separated public subnets for the NAT/ALB | subnet-aaa111,subnet-bbb222 |
| PrivateSubnetIds | Comma‑separated private subnets for your ECS tasks | subnet-ccc333,subnet-ddd444 |
| OpenAIArn | ARN of Secrets Manager secret holding {"OPENAI_API_KEY": "…"} | arn:aws:secretsmanager:us-west-2:920904165384:secret:openai-key |
| PhoenixArn | ARN of secret holding {"PHOENIX_API_KEY": "…"} | arn:aws:secretsmanager:us-west-2:920904165384:secret:phoenix-key |
(Optional) Extending for Additional Components (Frontend, DB, etc.)
Once you have Phoenix + your agent/LLM task up and running, you can easily add more services to the same VPC:- Create new ECR repos for your frontend, backend, DB‑migrations job, worker service, etc.
-
Add new TaskDefinitions / Services to your
app.yml(or split each into its own CFN stack): -
Subnet segmentation If you want stricter isolation, you can carve out “app‑subnets” vs “db‑subnets”, each with its own route table and SG rules. Just update
phoenix-network.ymlto output those extra subnet IDs. -
Security groups per tier
- ALB SG → allows 0.0.0.0/0 on 80/443
- App SG → allows inbound from ALB SG on 80
- DB SG → allows inbound from App SG on 5432 (Postgres) or 3306 (MySQL)

