Skip to content

Environment

The benchmark ran in the AWS environment below, defined in terraform/. The values shown are the Terraform defaults. To reproduce it in another account, see Adapting to another account.

Layout

Host Instance Region / AZ VPC CIDR AMI Login user
trn trn2.3xlarge (optional Capacity Block) ap-southeast-4c 10.10.0.0/16 Neuron vLLM DLAMI, AL2023 ec2-user
g4dn g4dn.xlarge us-east-1c 10.20.0.0/16 PyTorch DLAMI, open-source NVIDIA driver, AL2023 ec2-user
g7e g7e.2xlarge (optional Capacity Reservation) us-east-2b 10.40.0.0/16 Same as g4dn ec2-user
g6 g6.12xlarge (optional Capacity Reservation) us-east-1c 10.50.0.0/16 Same as g4dn ec2-user
bench m8id.2xlarge us-east-1c 10.30.0.0/16 Ubuntu 24.04 ubuntu
<vpc>_bench (optional) Set per VPC in local_bench_instance_types The target's The target's Ubuntu 24.04 ubuntu

The <vpc>_bench hosts are runner hosts: each runs the benchmark harness beside a target's vLLM host, in its VPC and private subnet. Terraform creates one for each VPC that local_bench_instance_types lists (none by default).

The hosts are in three regions only because that's where capacity was available. Each VPC has a private subnet behind a NAT gateway and an S3 gateway endpoint, and is peered with the bench VPC. Hosts have no public IP or inbound access from outside, and are reached through SSM Session Manager.

Other resources:

  • S3 bucket snap-asr-bench-<suffix> in region (terraform output bucket_name and bucket_region), with src/ (code), inputs/ (benchmark inputs) and results/ (run JSONL).
  • Instance role with SSM, read and write on the bucket, read on any input_bucket_names, and pull and push on the trn2 ECR repository.
  • ECR repository for the trn2 image, named by trn_ecr_repository (snap-vllm-neuron) in trn_region. It's created outside Terraform (Container images).
  • Security groups: inference hosts accept all traffic from the bench subnet, and from their VPC's runner host if there is one, and allow outbound TCP 443 only. Bench allows outbound TCP 443, 80 (apt) and all traffic to the peered VPCs. A runner host allows outbound TCP 443, 80 and all traffic within its VPC. See Design decisions.

Workstation prerequisites

The full list, with versions and what each make target needs, is in Developer tools. In short: AWS CLI v2 with the Session Manager plugin, Terraform 1.6 or later with access to the state, jq and uv. Credentials come from the standard AWS chain. Export AWS_PROFILE, or set aws_profile in terraform/terraform.tfvars to pin Terraform to a profile.

The docs use these shell variables:

export AWS_PROFILE=<profile>
BUCKET="$(terraform -chdir=terraform output -raw bucket_name)"
terraform -chdir=terraform output instance_ids   # SSM targets
terraform -chdir=terraform output private_ips    # for targets.toml

Connect to a host

aws ssm start-session --region "$(terraform -chdir=terraform output -json instance_regions | jq -r .<host>)" --target "$(terraform -chdir=terraform output -json instance_ids | jq -r .<host>)"
sudo -iu ec2-user   # or ubuntu on the bench and runner hosts

SSH over Session Manager

Plain ssh (and rsync, scp and snap-asr-bench --on-host) works through Session Manager too, with no inbound port open: SSM's AWS-StartSSHSession document tunnels the SSH connection. Give each host an entry in ~/.ssh/config:

# Bench host
Host snap-bench
  HostName <bench-instance-id>
  User <bench-user>
  IdentityFile ~/.ssh/<private-key>
  ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p' --region <bench-region>"

# g4dn inference host
Host snap-g4dn
  HostName <g4dn-instance-id>
  User ec2-user
  IdentityFile ~/.ssh/<private-key>
  ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p' --region <g4dn-region>"

# g7e inference host
Host snap-g7e
  HostName <g7e-instance-id>
  User ec2-user
  IdentityFile ~/.ssh/<private-key>
  ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p' --region <g7e-region>"

# g6 inference host
Host snap-g6
  HostName <g6-instance-id>
  User ec2-user
  IdentityFile ~/.ssh/<private-key>
  ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p' --region <g6-region>"

# trn2 inference host
Host snap-trn2
  HostName <trn2-instance-id>
  User ec2-user
  IdentityFile ~/.ssh/<private-key>
  ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p' --region <trn2-region>"

# trn2 runner host; likewise for each runner
Host snap-apse4-runner
  HostName <trn2-runner-instance-id>
  User ubuntu
  IdentityFile ~/.ssh/<private-key>
  ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p' --region <trn2-region>"
Field Value
Host Any name. --on-host connects to each target's runner_host from the targets file, or without one to its vllm_host or name, so use those names here.
HostName The instance ID, from terraform -chdir=terraform output instance_ids. The ProxyCommand passes it to SSM as %h. It changes when Terraform replaces the instance.
--region The instance's region, from terraform -chdir=terraform output instance_regions. Each host has its own: by default us-east-1 for bench, g4dn and g6, us-east-2 for g7e and ap-southeast-4 for trn2.
User ec2-user on the inference hosts, ubuntu on the runner hosts. On the bench host, the user whose authorized_keys holds your key.
IdentityFile Your private key. Its public half must be in that user's ~/.ssh/authorized_keys on the host.

The ProxyCommand runs the AWS CLI, so it needs the Session Manager plugin and current credentials for the account: export AWS_PROFILE before you connect, or add --profile <profile> to each ProxyCommand. Your credentials need ssm:StartSession on the instance and on the AWS-StartSSHSession document.

To add your public key to a host, open a Session Manager session as above, then:

sudo -iu ec2-user   # or ubuntu on the bench and runner hosts
mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '<your-public-key>' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys

Check each name. Each command should print the host's name without asking for anything:

for h in snap-bench snap-g4dn snap-g7e snap-g6 snap-trn2 snap-apse4-runner; do ssh -o BatchMode=yes "${h}" hostname; done

Provision

terraform -chdir=terraform init
terraform -chdir=terraform apply

Terraform creates the network, bucket, role and instances. Host software is set up afterwards, with the install-* make targets or by hand: bench, NVIDIA, trn2 and the log sidecar.

Adapting to another account

Nothing account-specific is in the shipped files. Override settings in terraform/terraform.tfvars (start from terraform/terraform.tfvars.example) and in *.local.env files next to the env files:

Setting Where Default
AWS profile aws_profile Unset: the standard credential chain
Regions and availability zones region, bench_az, g4dn_az, g7e_region, g7e_az, g6_region, g6_az, trn_region, trn_az The values in Layout. Each instance type is only offered in some zones.
Capacity reservations trn_capacity_reservation_id (with trn_capacity_block), g7e_capacity_reservation_id, g6_capacity_reservation_id Unset: On-Demand. Reservations end on a fixed date, after which apply fails until the variable is changed or unset.
Extra input buckets input_bucket_names None
trn2 ECR repository trn_ecr_repository snap-vllm-neuron
trn2 image IMAGE in deploy/trn2/trn2.local.env A placeholder: build your own (Container images)
Other per-host vLLM settings deploy/<platform>/<host>.local.env None
trn_ami_ssm_parameter Terraform variable Tracks latest. Pin it if a newer DLAMI ships a driver the image doesn't support.

The scripts read the bucket's region and each host's region from Terraform outputs, so changing a region needs no script edits. Only the host names are fixed in code (Limitations).

Terraform uses a local backend, so its state lives on the machine that runs apply. If more than one person will manage the deployment, configure a remote backend (for example S3 with use_lockfile = true) before the first apply.

Egress rules

Some organisations run security tooling that deletes any all-protocol egress rule to 0.0.0.0/0, which would cut off SSM and S3. The port-specific rules avoid that. If SSM drops, check the egress rules first.