AWS CloudFormation
User Guide (Version )

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.

AWS::AppMesh::Route

Creates a route that is associated with a virtual router.

You can use the prefix parameter in your route specification for path-based routing of requests. For example, if your virtual service name is my-service.local and you want the route to match requests to my-service.local/metrics, your prefix should be /metrics.

If your route matches a request, you can distribute traffic to one or more target virtual nodes with relative weighting.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::AppMesh::Route", "Properties" : { "MeshName" : String, "RouteName" : String, "Spec" : RouteSpec, "Tags" : [ Tag, ... ], "VirtualRouterName" : String } }

YAML

Type: AWS::AppMesh::Route Properties: MeshName: String RouteName: String Spec: RouteSpec Tags: - Tag VirtualRouterName: String

Properties

MeshName

The name of the service mesh to create the route in.

Required: Yes

Type: String

Update requires: Replacement

RouteName

The name to use for the route.

Required: Yes

Type: String

Update requires: Replacement

Spec

The route specification to apply.

Required: Yes

Type: RouteSpec

Update requires: No interruption

Tags

Optional metadata that you can apply to the route 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.

Required: No

Type: List of Tag

Update requires: No interruption

VirtualRouterName

The name of the virtual router in which to create the route.

Required: Yes

Type: String

Update requires: Replacement

Return Values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the resource ARN. For example:

{ "Ref": "myRoute" }

When you pass the logical ID of an AWS::AppMesh::Route resource to the intrinsic Ref function, the function returns the route ARN, such as arn:aws:appmesh:us-east-1:555555555555:route/myRoute .

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

Arn

The full Amazon Resource Name (ARN) for the route.

MeshName

The name of the service mesh that the route resides in.

RouteName

The name of the route.

Uid

The unique identifier for the route.

VirtualRouterName

The name of the virtual router that the route is associated with.

Examples

Create a Route

This example creates a route with two weighted targets.

JSON

{ "Description": "Basic Test Route", "Resources": { "BasicRoute": { "Type": "AWS::AppMesh::Route", "Properties": { "RouteName": "TestRoute", "MeshName": null, "VirtualRouterName": null, "Spec": { "HttpRoute": { "Match": { "Prefix": "routePrefix" }, "Action": { "WeightedTargets": [ { "VirtualNode": null, "Weight": 10 }, { "VirtualNode": null, "Weight": 20 } ] } } }, "Tags": [ { "Key": "Key1", "Value": "Value1" }, { "Key": "Key2", "Value": "Value2" } ] } } }, "Outputs": { "RouteName": { "Description": "Name of the Route", "Value": { "Fn::GetAtt": [ "BasicRoute", "RouteName" ] } }, "MeshName": { "Description": "Name of the Mesh", "Value": { "Fn::GetAtt": [ "BasicRoute", "MeshName" ] } }, "VirtualRouterName": { "Description": "Name of the VirtualRouter", "Value": { "Fn::GetAtt": [ "BasicRoute", "VirtualRouterName" ] } }, "Arn": { "Description": "Arn of the Route created", "Value": { "Fn::GetAtt": [ "BasicRoute", "Arn" ] } }, "Uid": { "Description": "Uid of the Route created", "Value": { "Fn::GetAtt": [ "BasicRoute", "Uid" ] } } } }

YAML

Description: "Basic Test Route" Resources: BasicRoute: Type: "AWS::AppMesh::Route" Properties: RouteName: "TestRoute" MeshName: !ImportValue TestMeshName VirtualRouterName: !ImportValue TestVirtualRouterName1 Spec: HttpRoute: Match: Prefix: "routePrefix" Action: WeightedTargets: - VirtualNode: !ImportValue TestVirtualNodeName1 Weight: 10 - VirtualNode: !ImportValue TestVirtualNodeName2 Weight: 20 Tags: - Key: "Key1" Value: "Value1" - Key: "Key2" Value: "Value2" Outputs: RouteName: Description: Name of the Route Value: Fn::GetAtt: - BasicRoute - RouteName MeshName: Description: Name of the Mesh Value: Fn::GetAtt: - BasicRoute - MeshName VirtualRouterName: Description: Name of the VirtualRouter Value: Fn::GetAtt: - BasicRoute - VirtualRouterName Arn: Description: Arn of the Route created Value: Fn::GetAtt: - BasicRoute - Arn Uid: Description: Uid of the Route created Value: Fn::GetAtt: - BasicRoute - Uid

See Also

  • Routes in the AWS App Mesh User Guide .

  • CreateRoute in the AWS App Mesh API Reference .