TerraformPilot

DevOps

Terraform for Physical AI: Edge and Robotics Backends on AWS

Provision Physical AI infrastructure with Terraform: edge-cloud backends, robotics telemetry, IoT ingestion, and low-latency compute zones.

LLuca Berton1 min read

Physical AI — robotics, autonomous machines, and embodied agents — is one of the defining 2026 themes. These systems blur the line between hardware and software, and they need a low-latency cloud backbone for telemetry, model updates, and remote control. Terraform provisions that backbone repeatably across regions and edge locations.

This guide shows how to build a Physical AI backend on AWS with Terraform.

Reference Architecture

#
LayerAWS service
Device fleetAWS IoT Core, IoT Device Management
Telemetry ingestKinesis Data Streams, IoT Rule Actions
Hot storageDynamoDB, Timestream
Cold storage / replayS3 + Athena
Edge computeWavelength, Local Zones, Outposts
Model deploySageMaker Edge, Greengrass

Device Provisioning Template

#
resource "aws_iot_thing_type" "robot" {
  name = "robot-v2"
 
  thing_type_properties {
    description = "Generation-2 mobile robot"
    searchable_attributes = ["site", "model", "firmware"]
  }
}
 
resource "aws_iot_policy" "robot" {
  name = "robot-policy"
 
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [{
      Effect   = "Allow"
      Action   = ["iot:Connect"]
      Resource = "arn:aws:iot:${var.region}:${data.aws_caller_identity.me.account_id}:client/$${iot:Connection.Thing.ThingName}"
    }, {
      Effect = "Allow"
      Action = ["iot:Publish"]
      Resource = [
        "arn:aws:iot:${var.region}:${data.aws_caller_identity.me.account_id}:topic/robots/$${iot:Connection.Thing.ThingName}/telemetry",
        "arn:aws:iot:${var.region}:${data.aws_caller_identity.me.account_id}:topic/robots/$${iot:Connection.Thing.ThingName}/events"
      ]
    }]
  })
}
 
resource "aws_iot_provisioning_template" "robot" {
  name                  = "robot-fleet-template"
  provisioning_role_arn = aws_iam_role.iot_provisioning.arn
  enabled               = true
  template_body         = file("${path.module}/templates/robot.json")
}

Telemetry Pipeline

#
resource "aws_kinesis_stream" "telemetry" {
  name             = "robot-telemetry"
  shard_count      = 8
  retention_period = 168 # 7 days
 
  stream_mode_details {
    stream_mode = "ON_DEMAND"
  }
}
 
resource "aws_iot_topic_rule" "telemetry_to_kinesis" {
  name        = "robot_telemetry_to_kinesis"
  enabled     = true
  sql         = "SELECT *, topic(2) AS robot_id FROM 'robots/+/telemetry'"
  sql_version = "2016-03-23"
 
  kinesis {
    role_arn      = aws_iam_role.iot_to_kinesis.arn
    stream_name   = aws_kinesis_stream.telemetry.name
    partition_key = "$${robot_id}"
  }
}
 
resource "aws_timestreamwrite_database" "fleet" {
  database_name = "robot_fleet"
}
 
resource "aws_timestreamwrite_table" "telemetry" {
  database_name = aws_timestreamwrite_database.fleet.database_name
  table_name    = "telemetry"
 
  retention_properties {
    memory_store_retention_period_in_hours  = 24
    magnetic_store_retention_period_in_days = 365
  }
}

Edge Compute With Wavelength

#

For autonomy controllers that need <10 ms latency:

data "aws_availability_zones" "wavelength" {
  filter {
    name   = "zone-type"
    values = ["wavelength-zone"]
  }
}
 
resource "aws_subnet" "wavelength" {
  vpc_id            = var.vpc_id
  cidr_block        = "10.0.99.0/24"
  availability_zone = data.aws_availability_zones.wavelength.names[0]
}
 
resource "aws_instance" "edge_inference" {
  ami           = data.aws_ami.deep_learning.id
  instance_type = "g4dn.2xlarge"
  subnet_id     = aws_subnet.wavelength.id
}

OTA Model Updates With Greengrass

#
resource "aws_iot_thing_group" "fleet_us" {
  name = "fleet-us"
}
 
resource "aws_greengrassv2_component_version" "vision_model" {
  inline_recipe = jsonencode({
    RecipeFormatVersion = "2020-01-25"
    ComponentName       = "com.acme.vision"
    ComponentVersion    = var.vision_model_version
    Manifests = [{
      Platform   = { os = "linux", architecture = "aarch64" }
      Lifecycle  = { Run = "python3 -m vision_runner" }
      Artifacts  = [{ Uri = "s3://${aws_s3_bucket.models.bucket}/vision-${var.vision_model_version}.tar.gz" }]
    }]
  })
}

Best Practices

#
  • Provision per-region stacks with a Terraform module so you can roll out new sites repeatably.
  • Use IoT Device Defender to alert on certificate or auth anomalies in the fleet.
  • Separate hot (Timestream) from cold (S3+Athena) so telemetry replay doesn't blow up costs.
  • Pin Greengrass component versions in code; never deploy latest to a robot fleet.
#
#Terraform#AI#IoT#Edge#Robotics

Share this article