---
title: "PUT /v20190125/meshes/{meshName}/virtualRouters"
method: PUT
path: "/v20190125/meshes/{meshName}/virtualRouters"
---

# PUT /v20190125/meshes/{meshName}/virtualRouters

`PUT /v20190125/meshes/{meshName}/virtualRouters`

Creates a virtual router within a service mesh.

Specify a `listener` for any inbound traffic that your virtual router receives. Create a virtual router for each protocol and port that you need to route. Virtual routers handle traffic for one or more virtual services within your mesh. After you create your virtual router, create and associate routes for your virtual router that direct incoming requests to different virtual nodes.

For more information about virtual routers, see [Virtual routers](https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_routers.html).

## Path parameters

- `meshName` string, required

## Query parameters

- `meshOwner` string

## Request body

- object
  - `clientToken` string — Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
  - `spec` object, required — An object that represents the specification of a virtual router.
    - `listeners` VirtualRouterListener[] — The listeners that the virtual router is expected to receive inbound traffic from. You can specify one listener.
      - `portMapping` PortMapping, required — An object that represents a port mapping.
        - `port` integer, required — The port used for the port mapping.
        - `protocol` 'http' | 'tcp' | 'http2' | 'grpc', required — The protocol used for the port mapping. Specify one protocol.
  - `tags` TagRef[] — Optional metadata that you can apply to the virtual router to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
    - `key` string, required — One part of a key-value pair that make up a tag. A <code>key</code> is a general label that acts like a category for more specific tag values.
    - `value` string, required — The optional part of a key-value pair that make up a tag. A <code>value</code> acts as a descriptor within a tag category (key).
  - `virtualRouterName` string, required — The name to use for the virtual router.

## Response `200`

Success

- CreateVirtualRouterOutput — <zonbook></zonbook><xhtml></xhtml>
  - `virtualRouter` object, required — The full description of your virtual router following the create call.
    - `meshName` string, required — The name of the service mesh that the virtual router resides in.
    - `metadata` object, required — The associated metadata for the virtual router.
      - `arn` string, required — The full Amazon Resource Name (ARN) for the resource.
      - `createdAt` string, date-time, required — The Unix epoch timestamp in seconds for when the resource was created.
      - `lastUpdatedAt` string, date-time, required — The Unix epoch timestamp in seconds for when the resource was last updated.
      - `meshOwner` string, required — The Amazon Web Services IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see <a href="https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html">Working with shared meshes</a>.
      - `resourceOwner` string, required — The Amazon Web Services IAM account ID of the resource owner. If the account ID is not your own, then it's the ID of the mesh owner or of another account that the mesh is shared with. For more information about mesh sharing, see <a href="https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html">Working with shared meshes</a>.
      - `uid` string, required — The unique identifier for the resource.
      - `version` integer, required — The version of the resource. Resources are created at version 1, and this version is incremented each time that they're updated.
    - `spec` object, required — The specifications of the virtual router.
      - `listeners` VirtualRouterListener[] — The listeners that the virtual router is expected to receive inbound traffic from. You can specify one listener.
        - `portMapping` PortMapping, required — An object that represents a port mapping.
          - `port` integer, required — The port used for the port mapping.
          - `protocol` 'http' | 'tcp' | 'http2' | 'grpc', required — The protocol used for the port mapping. Specify one protocol.
    - `status` object, required — The current status of the virtual router.
      - `status` 'ACTIVE' | 'INACTIVE' | 'DELETED', required — The current status of the virtual router.
    - `virtualRouterName` string, required — The name of the virtual router.

## Other responses

- `480` — NotFoundException
- `481` — BadRequestException
- `482` — ConflictException
- `483` — TooManyRequestsException
- `484` — ForbiddenException
- `485` — ServiceUnavailableException
- `486` — InternalServerErrorException
- `487` — LimitExceededException

---

[API](https://skmtc.net/aws/apis/appmesh.md) · [All operations](https://skmtc.net/aws/apis/appmesh/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/appmesh/versions/bfbda8660009/schema)
