AWS CLI v2 installed and configured (aws configure) with credentials that can deploy CloudFormation stacks.
Export your AWS Account and Region for future useBefore you run any of the CloudFormation or ECR commands, export two env‑vars so you don’t have to repeat your account/region everywhere:
# grab your AWS account ID and default region from your CLI credsexport ACCOUNT=$(aws sts get-caller-identity --query Account --output text)export REGION=$(aws configure get region)
Copy the following JSON file of permissions:permissions.jsonBefore 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.
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:
3. Push Phoenix and your apps (backend, frontend, db)
If you’ve built locally:
# Tag your local Phoenix imagedocker pull arizephoenix/phoenixdocker tag arizephoenix/phoenix:latest \ $ACCOUNT.dkr.ecr.$REGION.amazonaws.com/phoenix:latest# Push to ECRdocker push $ACCOUNT.dkr.ecr.$REGION.amazonaws.com/phoenix:latest# Repeat for your appdocker tag my-app:latest \ $ACCOUNT.dkr.ecr.$REGION.amazonaws.com/my-app:latestdocker push $ACCOUNT.dkr.ecr.$REGION.amazonaws.com/my-app:latest
Make sure to change AZ1 and AZ2 to match your region.You can now access your VPC and public + private subnet IDs at AWS -> CloudFormation -> Stacks -> phoenix-network -> Outputs.
Copy this CloudFormation template:phoenix-auth.ymlYou are now ready to deploy Phoenix to AWS.Deploy thephoenix-auth.ymlstack
Consume the network stack’s outputs (VPC‑ID, PublicSubnetIds, PrivateSubnetIds) along with your new ECR URI:
Once you have your Phoenix System API key, bundle it (and any other service keys) into AWS Secrets Manager:
# Store Phoenix API keyaws secretsmanager create-secret \ --name phoenix-system-api-key \ --description "Phoenix System API Key for OTLP traces" \ --secret-string '{"PHOENIX_API_KEY":"<PASTE SYSTEM KEY HERE>"}'# (Optional) Store other service keys similarly:aws secretsmanager create-secret \ --name openai-api-key \ --description "OpenAI API key for LLM calls" \ --secret-string '{"OPENAI_API_KEY":"<PASTE OPENAI KEY HERE>"}'
You can now reference these secrets in your downstream CloudFormation templates (e.g. in your application stacks) via the PhoenixArn, OpenAIArn, etc., parameters.
Copy this CloudFormation template:app.ymlThis CloudFormation stack (app.yml) 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
The app container will:
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
IMPORTANT: This template assumes only one secret is being used (OpenAI API Key). Make sure to add ARNs for additional secrets in the list of parameters (line 34 and line 86) and store those additional secrets as environment variables (line 134).Template parameters
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.yml to 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)
With these patterns you can grow from one simple “agent-only” service into a multi‑tier architecture, all launched and managed via CloudFormation.