Skip to content
agentgateway has joined the Agentic AI FoundationLearn more

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

AWS

Page as Markdown

Run agentgateway on AWS and reach Amazon Bedrock with an IAM role instead of an API key.

Verified Code examples on this page have been automatically tested and verified.

Run agentgateway on Amazon ECS or Amazon EKS, and reach Amazon Bedrock with the IAM role that AWS already gives the container. No API key goes into your configuration file.

Authenticate with an IAM role

On ECS and EKS, AWS supplies credentials to the container through the task role or the pod’s service account. Agentgateway signs Bedrock requests with SigV4 using those ambient credentials. Set auth.aws to an empty object to use them.

Review the following example configuration.
# yaml-language-server: $schema=https://agentgateway.dev/schema/config

llm:
  models:
  - name: "*"
    provider: bedrock
    params:
      awsRegion: us-east-1
    auth:
      aws: {}

Review the following table to understand this configuration.

SettingDescription
nameThe model name to match in incoming requests. Use * to match any model name.
providerThe LLM provider, set to bedrock for Amazon Bedrock.
params.awsRegionThe AWS region to send Bedrock requests to.
auth.awsAWS authentication. An empty object uses the credentials that the environment already provides, such as an ECS task role, an EC2 instance profile, or AWS_* environment variables.

For the full list of Bedrock settings, including passthrough and token counting, see Amazon Bedrock.

Run on Amazon ECS

Run agentgateway as an ECS service on Fargate or EC2. The container needs three things: the image, a configuration file, and a task role.

The following task definition mounts an EFS file system at /config and points agentgateway at the file on it. Replace the file system ID, the role ARNs, and the region with your own values.

{
  "family": "agentgateway",
  "networkMode": "awsvpc",
  "taskRoleArn": "arn:aws:iam::123456789012:role/agentgateway-task",
  "executionRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
  "requiresCompatibilities": ["FARGATE"],
  "cpu": "512",
  "memory": "1024",
  "volumes": [
    {
      "name": "config",
      "efsVolumeConfiguration": {
        "fileSystemId": "fs-0123456789abcdef0",
        "transitEncryption": "ENABLED"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "agentgateway",
      "image": "cr.agentgateway.dev/agentgateway:latest-dev",
      "command": ["-f", "/config/config.yaml"],
      "portMappings": [
        {"containerPort": 4000, "protocol": "tcp"}
      ],
      "mountPoints": [
        {"sourceVolume": "config", "containerPath": "/config"}
      ],
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/agentgateway",
          "awslogs-region": "us-east-1",
          "awslogs-stream-prefix": "agentgateway"
        }
      }
    }
  ]
}

Note the following details.

  • Port 4000 carries LLM traffic. When your configuration file defines no gateway, the implied default gateway serves LLM traffic on port 4000 and MCP traffic on port 3000. Publish the port that carries the traffic you route. For more information, see Configuration modes.
  • The task role is the credential. Because auth.aws uses ambient credentials, taskRoleArn is what lets agentgateway call Bedrock. No API key is needed in the task definition or in the configuration file.
  • Pin the image tag. The example pins the tag for this documentation version rather than using latest, so that a new release does not change the running proxy without your involvement.

Important

Do not publish the admin address from an ECS task. The admin address has no authentication, and an ECS service is usually reachable from a load balancer. To reach the UI, serve it on a gateway instead, where you can attach an authentication policy. For more information, see Serve the UI on a gateway.

If the EFS volume is mounted read-only, or you bake the configuration file into your own image, set config.storage.mode to readOnly so that writes from the UI fail with a clear message instead of a filesystem error. For more information, see Configuration storage.

Run on Amazon EKS

EKS is an ordinary Kubernetes distribution as far as agentgateway is concerned. Two options are available.

  • Run standalone agentgateway as a Deployment with the Helm chart. Attach the IAM role to the pod’s service account with IAM Roles for Service Accounts (IRSA) or EKS Pod Identity, and the same auth.aws: {} configuration applies.
  • Run the Kubernetes control plane, which manages agentgateway proxies from Kubernetes custom resources and the Kubernetes Gateway API.

IAM permissions

Attach a policy such as the following to the task role or the IRSA role. Narrow the Resource values to the models and secrets that you actually use.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Resource": "arn:aws:bedrock:*:*:model/*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "secretsmanager:GetSecretValue"
      ],
      "Resource": "arn:aws:secretsmanager:*:*:secret:llm-*"
    }
  ]
}

The secretsmanager statement is needed only if you also route to a non-AWS provider whose API key you store in Secrets Manager.

AWS services

ServiceHow it is used
Amazon BedrockClaude, Llama, and other foundation models, reached with the task role
AWS Secrets ManagerStorage for the API keys of non-AWS providers
AWS Application Load BalancerLoad balancing and TLS termination in front of the gateway port
Amazon CloudWatchDestination for the container logs configured by awslogs
AWS X-RayTrace collection, through an OpenTelemetry collector

Next steps

Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.