The ERP Financial Agent is deployed entirely on AWS. This page walks through creating and configuring every required service before you run the CloudFormation stack. All steps assume theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/yohangr3/agentelanggrafh/llms.txt
Use this file to discover all available pages before exploring further.
us-east-1 region unless otherwise noted.
All service-to-service communication uses IAM roles — no access keys are stored in the application code. The ECS task role grants exactly the permissions listed in this guide; no more, no less.
Required AWS services at a glance
| Service | Purpose |
|---|---|
| Amazon Bedrock | Hosts Claude Sonnet 4.5 (LLM) and Amazon Titan Embed v2 (embeddings) |
| AWS Cognito | Issues and validates JWT tokens for every API request |
| Amazon ElastiCache (Redis 7.0) | Session checkpoints, rate-limit counters, uploaded-file cache |
| Amazon RDS (MySQL 8) | SAP/ERP financial data (read-only access by the agent) |
| Amazon DynamoDB | Long-term conversation memory and query audit log |
| Amazon ECR | Container image registry for backend and frontend |
| Amazon ECS Fargate | Serverless container runtime (2 vCPU / 4 GB per task) |
| AWS Secrets Manager | Secure storage for the RDS password (production) |
Step-by-step setup
us-east-1.
| Model | Inference profile ID | Use |
|---|---|---|
| Claude Sonnet 4.5 | us.anthropic.claude-sonnet-4-5-20250929-v1:0 | General LLM (SQL gen, intent, explanation) |
| Claude Sonnet 5 | us.anthropic.claude-sonnet-5 | Reasoning-intensive nodes |
| Amazon Titan Embed Text v2 | amazon.titan-embed-text-v2:0 | Schema registry embeddings |
The agent uses cross-region inference profiles (
us.* prefix), not base model IDs. The profile ID must be used exactly as shown in BEDROCK_MODEL_ID; substituting the bare model ID will fail at runtime.The application validates every API request against a Cognito User Pool. The pool ID is required at startup via
COGNITO_USER_POOL_ID.- Sign-in identifier: Email (required)
- Optional: Username (if you want
cognito:usernamein tokens)
email- Custom attribute
custom:tenantId(string, mutable) — used for multi-tenant isolation - Custom attribute
custom:company(string, mutable) — displayed in the UI
- Auth flows:
ALLOW_USER_SRP_AUTH,ALLOW_REFRESH_TOKEN_AUTH - Token validity: Access token 1 hour, ID token 1 hour, Refresh token 30 days
- Note the Client ID (set as
COGNITO_CLIENT_ID)
COGNITO_USER_POOL_ID).The RBAC system maps Cognito group membership to roles and permissions. Create these groups in User Pool → Groups:
platform_adminorg_adminfinance_leadanalystviewerThe legacy group names
admin, admins, and administrators are recognised as aliases for org_admin for backwards compatibility. New deployments should use platform_admin and org_admin directly.Assign users to groups in the Cognito console or via
aws cognito-idp admin-add-user-to-group. The group list appears in the cognito:groups claim of the ID token and is read by resolve_principal() in src/core/auth.py.Each API request must include
Authorization: Bearer <id_token>. The CognitoJWTValidator class in src/core/auth.py:kid (key ID) from the JWT header.https://cognito-idp.{region}.amazonaws.com/{user_pool_id}/.well-known/jwks.json (cached for 1 hour, auto-refreshed on key rotation).token_use == "id" and validates the issuer URL.COGNITO_CLIENT_ID is set, also verifies the aud claim.db.t3.medium or larger.DB_HOST).iafinagent (or your preferred name; set as DB_NAME).3306) only from the ECS security group.The agent opens a read-only connection to RDS. Create a dedicated database user with
SELECT grants only — do not use the master user. See the Database configuration guide for connection pool details.The CloudFormation template in
infra/cloudformation/services.yaml provisions a cache.t3.micro Redis 7.0 cluster automatically. If you are provisioning manually:7.0, Node type: cache.t3.micro (production: cache.r6g.large).REDIS_URL=redis://<endpoint>:6379/0.# Conversations table (long-term memory)
aws dynamodb create-table \
--table-name erp-agent-conversations \
--billing-mode PAY_PER_REQUEST \
--attribute-definitions \
AttributeName=user_id,AttributeType=S \
AttributeName=session_id,AttributeType=S \
--key-schema \
AttributeName=user_id,KeyType=HASH \
AttributeName=session_id,KeyType=RANGE
# Enable TTL
aws dynamodb update-time-to-live \
--table-name erp-agent-conversations \
--time-to-live-specification "Enabled=true,AttributeName=ttl"
# Query audit log table
aws dynamodb create-table \
--table-name erp-agent-query-log \
--billing-mode PAY_PER_REQUEST \
--attribute-definitions \
AttributeName=query_id,AttributeType=S \
AttributeName=timestamp,AttributeType=S \
--key-schema \
AttributeName=query_id,KeyType=HASH \
AttributeName=timestamp,KeyType=RANGE
aws ecr create-repository --repository-name erp-agent/backend \
--image-scanning-configuration scanOnPush=true
aws ecr create-repository --repository-name erp-agent/frontend \
--image-scanning-configuration scanOnPush=true
In production the database password is never stored as a plain-text environment variable. Instead:
aws secretsmanager create-secret \
--name erp-agent/db-password \
--description "Database password for ERP Financial Agent" \
--secret-string "your-secure-password"
IAM permissions for the ECS task role
The CloudFormation template creates two IAM roles automatically. The table below lists every permission granted to the ECS task role (erp-agent-task-role-<env>), which is the role assumed by the running container.
Bedrock — BedrockAccess policy
Bedrock — BedrockAccess policy
DynamoDB — DynamoDBAccess policy
DynamoDB — DynamoDBAccess policy
Secrets Manager — SecretsAccess policy
Secrets Manager — SecretsAccess policy
erp-agent-execution-role-<env>) also holds secretsmanager:GetSecretValue on the same ARN so the ECS agent can inject the secret at task launch.S3 — S3ExportsAccess policy
S3 — S3ExportsAccess policy
ECR — ECS execution role
ECR — ECS execution role
Deploying with CloudFormation
Once all services exist, deploy the full stack with:DatabasePassword is stored immediately in Secrets Manager by the CloudFormation stack and is never written to disk or logs after that. The NoEcho: true property on the parameter prevents it from appearing in CloudFormation events.