Components and Sizing Recommendations
Prerequisites
Ensure the following tools and resources are installed and available:
- AWS Account with permissions to create ECS, EC2, VPC, ELB, IAM, S3, Secrets Manager, and CloudWatch resources.
- AWS CLI configured with credentials.
- Terraform v1.13 or later.
Create a Strata Cloud Manager account
- Go to the the AI Gateway website.
- Sign up for a Strata Cloud Manager account.
- Once logged in, locate and save your
Organisation ID for future reference. It can be found in the browser URL:
https://stratacloudmanager.paloaltonetworks.com/<organisation_id>/
- Contact the Palo Alto Networks team and provide your Organisation ID and the email address used during signup.
- The Palo Alto Networks team will share the following information with you:
- Docker credentials for the Gateway images (username and password).
- License: Client Auth Key.
Setup Project Environment
1. Prepare AWS Secrets
Create the required secrets in AWS Secrets Manager. You can either use the CloudFormation template provided in the portkey-gateway-infrastructure repository, or create them manually using the AWS CLI.
Option A: Using CloudFormation
- Go to the AWS CloudFormation Console and create a stack.
- Upload
cloudformation/secrets.yaml from the portkey-gateway-infrastructure repository.
- Provide the following parameters:
- Project Name — e.g.,
portkey-gateway
- Environment — e.g.,
dev
- Docker Username / Password — provided by the AI Gateway
- AI Gateway Client Auth — provided by the AI Gateway
- Organisations — your AI Gateway Organisation ID(s), comma-separated if multiple
- After the stack completes, note the following outputs for use in the Terraform configuration:
DockerCredentialsSecretArn
ClientOrgSecretNameArn
Option B: Using AWS CLI
Note the ARNs returned for both secrets — they will be used in the Terraform configuration.
Create a new directory for your deployment:
(Optional) Create an S3 bucket to store the Terraform state remotely:
Create a backend.config file:
3. Create Module Configuration
Create a main.tf file:
4. Deploy the Gateway
Note: Values in the secrets block must be AWS Secrets Manager ARNs, not raw secret values. The ECS task definition references the secret ARN directly and AWS injects the secret value at runtime.
Advanced Configuration
MCP Gateway (Optional)
By default, only the AI Gateway is enabled. To enable the MCP Gateway, update your module configuration:
MCP Only:
Gateway + MCP (single service, ALB required):
Notes:
mcp_gateway_base_url is required when server_mode is "mcp" or "all". It must be the MCP external domain (with https:// or http:// prefix) that clients use to reach the MCP service.
- When
server_mode = "all", an Application Load Balancer is required (lb_type = "application") and you must configure host-based routing via alb_routing_configuration (gateway_host and mcp_host).
- For the initial deployment, you can set
mcp_gateway_base_url to a placeholder, then update it after the Load Balancer is provisioned and DNS is mapped.
Server Modes
"gateway": Deploys only the AI Gateway. This is the default configuration.
"mcp": Deploys only the MCP Gateway. Requires mcp_gateway_base_url.
"all": Deploys both the AI Gateway and MCP Gateway. Requires mcp_gateway_base_url and an ALB with host-based routing.
Auto-Scaling Configuration
Control how ECS tasks scale based on CPU and memory utilisation:
Deployment Strategies
ECS supports multiple deployment strategies via gateway_deployment_configuration:
Blue/Green Deployment:
Canary Deployment:
Network Configuration with VPC
Deploy the Gateway within a VPC.
Create a new VPC:
Use an existing VPC and subnets:
Load Balancer Ingress
The module can provision either an Application Load Balancer (ALB) or a Network Load Balancer (NLB) in front of the Gateway tasks. Pick based on what you need:
Application Load Balancer (ALB)
Deploy a public ALB with TLS termination:
Host-based Routing (required when server_mode = "all"):
Configure DNS:
Enable ALB Access Logs:
Network Load Balancer (NLB)
Note: NLB does not support host-based routing, so it cannot be used when server_mode = "all".
Amazon ElastiCache for Redis
Use an existing Amazon ElastiCache cluster instead of the built-in Redis container:
If ElastiCache AUTH is enabled, store the AUTH token in AWS Secrets Manager (as JSON with a REDIS_PASSWORD key) and reference the secret ARN. Both the Gateway and Data Service connect to Redis, so the secret must be passed to both blocks if the Data Service is enabled:
Note: ElastiCache’s security groups must allow inbound TCP 6379 (or your configured port) from the Gateway and Data Service task security groups.
Object Storage (S3 Log Store)
Specify the S3 bucket for storing LLM access logs:
The module attaches an IAM policy to the Gateway task role granting s3:PutObject and s3:GetObject permissions on the configured buckets.
Data Service (Optional)
The Data Service is responsible for batch processing, fine-tuning, and log exports. Enable it via:
Amazon Bedrock (Optional)
To allow the Gateway to invoke Amazon Bedrock models, attach an IAM policy with the required bedrock:InvokeModel (and related) permissions to the Gateway ECS task role via gateway_task_role_policy_arns:
The module supports both same-account and cross-account Bedrock access (via sts:AssumeRole). For the full IAM policy documents, trust policy templates, and step-by-step setup for both modes, refer to following guide: Bedrock Access Configuration.
Integrating Gateway with Management Plane
Outbound Connectivity (Data Plane to Management Plane)
The Data Plane integrates with the Management Plane over the internet.
Over the Internet
Ensure the Gateway has access to the following endpoints over the internet:
https://aigw.portkey.ai
https://albus.portkey.ai
No additional configuration is needed if your VPC allows outbound internet access via a NAT Gateway.
Inbound Connectivity (Management Plane to Data Plane)
IP Whitelisting
Allows the Management Plane to access the Data Plane over the internet by restricting inbound traffic to specific IP addresses of the Management Plane. This method requires the Data Plane to have a publicly accessible endpoint.
To whitelist, add an inbound rule to the Load Balancer’s security group allowing connections from the AI Gateway Management Plane’s IPs on the listener port. Contact the Palo Alto Networks team for the current address list. Alternatively, set allowed_lb_cidrs in the module configuration:
To integrate the Management Plane with the Data Plane, contact the Palo Alto Networks team and provide the Public Endpoint of the Data Plane.
Verifying Gateway Integration with the Management Plane
-
Send a test request to the Gateway using
curl:
-
Go to the the AI Gateway website -> Logs.
-
Verify that the test request appears in the logs and that you can view its full details by selecting the log entry.
Uninstalling AI Gateway
Example Configurations
Minimal Development Deployment
This example shows a basic deployment with built-in Redis, a new VPC, and no load balancer:
Production Deployment with ALB, ElastiCache, and Data Service
This example shows a production-grade deployment with a public ALB, Amazon ElastiCache, the Data Service enabled, and auto-scaling:
Gateway + MCP Deployment
This example shows how to deploy both the AI Gateway and the MCP Gateway behind an Application Load Balancer with host-based routing:
Multi-Environment Setup
To manage dev, staging, and prod from a single codebase, organise your project as follows:
Each environment has its own remote state and variable values:
Deploy each environment independently:
Version Pinning and Upgrades
Always pin the module to a specific version in production:
To upgrade, review the release notes, test the new version in a non-production environment first, then promote to production:
To roll back, revert the ref to the previous version and re-run terraform init -upgrade && terraform apply.Last modified on September 24, 2026