AWS App Mesh
User Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Virtual Routers

Virtual routers handle traffic for one or more virtual services within your mesh. After you create a virtual router, you can create and associate routes for your virtual router that direct incoming requests to different virtual nodes.

Any inbound traffic that your virtual router expects should be specified as a listener.

Creating a Virtual Router

To create a virtual router, select the tool that you want to use to create it.

AWS Management Console
  1. Open the App Mesh console at https://console.aws.amazon.com/appmesh/.

  2. Choose the mesh that you want to create the virtual router in.

  3. Choose Virtual routers in the left navigation.

  4. Choose Create virtual router.

  5. For Virtual router name, specify a name for your virtual router. Up to 255 letters, numbers, hyphens, and underscores are allowed.

  6. For Listener, specify a Port and Protocol for your virtual router.

  7. Choose Create virtual router to finish.

AWS CLI

To create a virtual router with released features using the AWS CLI version 1.16.235 or higher, see the example in the AWS CLI reference for the create-virtual-router command.

(App Mesh Preview Channel only) To create a virtual router with an HTTP2 or GRPC listener.

  1. Download the Preview Channel service model with the following command.

    curl -o appmesh-preview-channel-service-model.json https://raw.githubusercontent.com/aws/aws-app-mesh-roadmap/master/appmesh-preview/service-model.json
  2. Add the Preview Channel service model to the AWS CLI with the following command.

    aws configure add-model \ --service-name appmesh-preview \ --service-model file://appmesh-preview-channel-service-model.json
  3. Create a JSON file named create-virtual-router.json with a virtual router configuration. In the following example JSON file, a virtual router with an HTTP2 listener is created in a mesh named app1. Alternately, for protocol you can replace http2 with grpc.

    { "meshName": "app1", "spec": { "listeners": [ { "portMapping": { "port": 80, "protocol": "http2" } } ] }, "virtualRouterName": "serviceB-http2" }
  4. Create the virtual router with the following command.

    aws appmesh-preview create-virtual-router --cli-input-json file://create-virtual-router.json