Skip to main content
The Portkey AI Gateway can be deployed to an EC2 instance using the CloudFormation template below. The template provisions an EC2 instance, installs Docker, pulls the gateway image, and configures a security group that exposes port 8787.

Deploy with CloudFormation

1

Copy the CloudFormation template

Save the following YAML as portkey-gateway.yaml:
portkey-gateway.yaml
2

Create a stack in the AWS CloudFormation console

Open the AWS CloudFormation console and choose Create stack. Upload portkey-gateway.yaml directly or upload it to S3 first and provide the S3 URL.
3

Fill in the stack parameters

4

Create the stack

Review the configuration and choose Create stack. CloudFormation provisions the instance, installs Docker, and starts the gateway container automatically via the UserData script.
5

Retrieve the gateway URL

Once the stack status shows CREATE_COMPLETE, open the Outputs tab. The PortkeyGatewayURL value contains the public URL for your gateway:

What the template provisions

  • EC2 instance — Amazon Linux 2, running the portkeyai/gateway:latest Docker image
  • Security group — Allows inbound TCP on port 8787 from 0.0.0.0/0 and unrestricted outbound
  • Region mapping — Pre-configured Amazon Linux 2 AMI IDs for 17 AWS regions
The default security group allows inbound traffic on port 8787 from all IP addresses. Restrict the CidrIp to your own CIDR range before deploying to a production environment.

Next steps

After the instance is running, mount a conf.json to configure credentials, plugins, and rate limits. See the configuration reference for details.