Defines an HTTP route for Service B in AWS App Mesh, distributing traffic between two virtual nodes based on weights.

Terraform Template

resource "aws_appmesh_route" "serviceb" {
  mesh_name = "aws_appmesh_mesh.simple.id"
  name = "serviceB-route"

  spec {

    http_route {

      action {

        weighted_target {
          virtual_node = "aws_appmesh_virtual_node.serviceb1.name"
          weight = 90
        }

        weighted_target {
          virtual_node = "aws_appmesh_virtual_node.serviceb2.name"
          weight = 10
        }
      }

      match {
        prefix = /
      }
    }
  }
  virtual_router_name = "aws_appmesh_virtual_router.serviceb.name"
}