Skip to main content

Deploy PromptLayer on AWS

Use this guide to deploy PromptLayer in your own AWS account. PromptLayer provides a deployment package with OpenTofu configuration, Helm values files, a release manifest, and registry credentials. The deployment has four phases:
  1. Prepare AWS access and customer-specific settings.
  2. Provision infrastructure with OpenTofu.
  3. Install cluster add-ons and OpenSearch.
  4. Install PromptLayer Helm charts.

What PromptLayer provides

PromptLayer sends a deployment package for your environment. It includes:

Before you begin

Make sure you have:
OpenTofu downloads provider binaries during tofu init. You do not install the AWS, Kubernetes, Helm, or HTTP providers separately.

Gather customer inputs

Decide these values before you run OpenTofu:

Prepare AWS access

Authenticate to the target AWS account and verify the identity:
Use the same account and region for all OpenTofu stages unless PromptLayer gives you a different architecture.

Prepare secrets

Create or select a Secrets Manager secret for RDS. The secret must contain the RDS master password and any database user passwords that the deployment package references. Example shape:
The exact secret name and JSON keys must match infra.tfvars and kubernetes.tfvars. Set the OpenSearch admin password as an environment variable before running the OpenSearch stage:
Unset it when the OpenSearch apply is complete:

Prepare the deployment package

From the package root, create local tfvars files from the examples:
Replace every placeholder with customer-specific values. At minimum:
Do not leave placeholder values, example domains, local-only email addresses, or development environment names in tfvars before applying.

Bootstrap OpenTofu state

Create a dedicated S3 bucket for OpenTofu state. The bootstrap script creates the bucket, enables versioning, blocks public access, enables SSE-S3 encryption, and writes the S3 backend config for all three AWS stages.
The bucket name is:
After the script runs, set the matching remote state values in each tfvars file: OpenTofu uses native S3 locking. You do not need a DynamoDB lock table.

Deploy infrastructure

The infrastructure stage creates the VPC, subnets, EKS cluster, node groups, RDS, ElastiCache Valkey, S3 buckets, security groups, and IAM roles for Kubernetes service accounts.
After apply, capture the outputs. You will need the EKS cluster name, RDS endpoint, Valkey endpoint, S3 bucket names, and IAM role ARNs for verification and support.
Configure kubectl for the new cluster:
Verify the cluster:

Deploy Kubernetes add-ons

The Kubernetes stage installs cluster add-ons such as cert-manager, ingress controllers, External Secrets, KEDA, monitoring, logging, and cluster autoscaling. Run this stage in two passes so cert-manager custom resources are available before you create the issuer and wildcard certificate.
1

First pass: install CRDs and add-ons

In the existing cert_manager object in kubernetes.tfvars, keep cluster_issuer.enabled and wildcard_certificate.enabled set to false.Then apply:
2

Second pass: enable certificates and TLS

In kubernetes.tfvars, set cert_manager.cluster_issuer.enabled and cert_manager.wildcard_certificate.enabled to true.For each ingress controller that should use the wildcard certificate, set enable_default_tls_from_wildcard_certificate and enable_wildcard_tls_from_wildcard_certificate to true.Apply again:
Verify the add-ons:

Deploy OpenSearch

Deploy OpenSearch after the EKS cluster and Kubernetes add-ons are ready. Before applying:
  1. Set eks_cluster_name in opensearch.tfvars to the cluster name from the infrastructure output.
  2. Set aws_region, environment, project_name, and default_tags.
  3. Confirm the OpenSearch node groups exist and use the labels and taints required by the deployment package.
  4. Export TF_VAR_opensearch_initial_admin_password.
Then apply:
Verify OpenSearch:

Install PromptLayer charts

Install the PromptLayer application charts after infrastructure, Kubernetes add-ons, and OpenSearch are ready. Use the release names, namespaces, values files, and chart versions from your release manifest. Run Helm from the directory that contains the values files.
1

Log in to the registry

Use --password-stdin so the password is not passed as a command-line argument.
2

Install sandbox-runtimes

3

Install sandboxes-api

4

Install promptlayer

If your values files reference Kubernetes image pull secrets, create those secrets before installing the charts. Use the names and namespaces from your release manifest.

Verify PromptLayer

Check the Helm releases:
Check application pods:
Check ingress and DNS:
Pods should reach Running or Completed status. Ingress hostnames should resolve through the DNS records created for the deployment.

Upgrade a release

For chart upgrades, use the chart version and values file from the release manifest:
Test chart upgrades in a staging environment before applying them to production.

Troubleshooting

If you need help with registry access, values files, or deployment issues, contact our enterprise team.