AWS CloudFormation
User Guide (Version )

AWS::AppMesh::VirtualNode

Creates a virtual node within a service mesh.

A virtual node acts as a logical pointer to a particular task group, such as an Amazon ECS service or a Kubernetes deployment. When you create a virtual node, you can specify the service discovery information for your task group.

Any inbound traffic that your virtual node expects should be specified as a listener. Any outbound traffic that your virtual node expects to reach should be specified as a backend.

The response metadata for your new virtual node contains the arn that is associated with the virtual node. Set this value (either the full ARN or the truncated resource name: for example, mesh/default/virtualNode/simpleapp) as the APPMESH_VIRTUAL_NODE_NAME environment variable for your task group's Envoy proxy container in your task definition or pod spec. This is then mapped to the node.id and node.cluster Envoy parameters.

Note

If you require your Envoy stats or tracing to use a different name, you can override the node.cluster value that is set by APPMESH_VIRTUAL_NODE_NAME with the APPMESH_VIRTUAL_NODE_CLUSTER environment variable.

Syntax

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

JSON

{ "Type" : "AWS::AppMesh::VirtualNode", "Properties" : { "MeshName" : String, "Spec" : VirtualNodeSpec, "Tags" : [ Tag, ... ], "VirtualNodeName" : String } }

YAML

Type: AWS::AppMesh::VirtualNode Properties: MeshName: String Spec: VirtualNodeSpec Tags: - Tag VirtualNodeName: String

Properties

MeshName

The name of the service mesh to create the virtual node in.

Required: Yes

Type: String

Update requires: Replacement

Spec

The virtual node specification to apply.

Required: Yes

Type: VirtualNodeSpec

Update requires: No interruption

Tags

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

VirtualNodeName

The name to use for the virtual node.

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": "myVirtualNode" }

When you pass the logical ID of an AWS::AppMesh::VirtualNode resource to the intrinsic Ref function, the function returns the virtual node ARN, such as arn:aws:appmesh:us-east-1:555555555555:virtualNode/myVirtualNode .

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 virtual node.

MeshName

The name of the service mesh that the virtual node resides in.

Uid

The unique identifier for the virtual node.

VirtualNodeName

The name of the virtual node.

Examples

Create a Virtual Node

This example creates a virtual node with two backends and a listener with a health check policy. It also sends access logs to a file path and uses DNS service discovery.

JSON

{ "Description": "Basic Test Virtual Node", "Resources": { "BasicVirtualNode": { "Type": "AWS::AppMesh::VirtualNode", "Properties": { "VirtualNodeName": "TestVirtualNode", "MeshName": null, "Spec": { "Backends": [ { "VirtualService": { "VirtualServiceName": "Backend_1" } }, { "VirtualService": { "VirtualServiceName": "Backend_2" } } ], "Listeners": [ { "HealthCheck": { "HealthyThreshold": 2, "IntervalMillis": 5000, "Path": "Path", "Port": 8080, "Protocol": "http", "TimeoutMillis": 2000, "UnhealthyThreshold": 2 }, "PortMapping": { "Port": 8080, "Protocol": "http" } } ], "ServiceDiscovery": { "DNS": { "Hostname": "Hostname" } }, "Logging": { "AccessLog": { "File": { "Path": "Path" } } } }, "Tags": [ { "Key": "Key1", "Value": "Value1" }, { "Key": "Key2", "Value": "Value2" } ] } } }, "Outputs": { "VirtualNodeName": { "Description": "Name of the VirtualNode", "Value": { "Fn::GetAtt": [ "BasicVirtualNode", "VirtualNodeName" ] } }, "MeshName": { "Description": "Name of the Mesh", "Value": { "Fn::GetAtt": [ "BasicVirtualNode", "MeshName" ] } }, "Arn": { "Description": "Arn of the VirtualNode created", "Value": { "Fn::GetAtt": [ "BasicVirtualNode", "Arn" ] } }, "Uid": { "Description": "Uid of the VirtualNode created", "Value": { "Fn::GetAtt": [ "BasicVirtualNode", "Uid" ] } } } }

YAML

Description: "Basic Test Virtual Node" Resources: BasicVirtualNode: Type: "AWS::AppMesh::VirtualNode" Properties: VirtualNodeName: "TestVirtualNode" MeshName: !ImportValue TestMeshName Spec: Backends: - VirtualService: VirtualServiceName: "Backend_1" - VirtualService: VirtualServiceName: "Backend_2" Listeners: - HealthCheck: HealthyThreshold: 2 IntervalMillis: 5000 Path: "Path" Port: 8080 Protocol: "http" TimeoutMillis: 2000 UnhealthyThreshold: 2 PortMapping: Port: 8080 Protocol: "http" ServiceDiscovery: DNS: Hostname: "Hostname" Logging: AccessLog: File: Path: "Path" Tags: - Key: "Key1" Value: "Value1" - Key: "Key2" Value: "Value2" Outputs: VirtualNodeName: Description: Name of the VirtualNode Value: Fn::GetAtt: - BasicVirtualNode - VirtualNodeName MeshName: Description: Name of the Mesh Value: Fn::GetAtt: - BasicVirtualNode - MeshName Arn: Description: Arn of the VirtualNode created Value: Fn::GetAtt: - BasicVirtualNode - Arn Uid: Description: Uid of the VirtualNode created Value: Fn::GetAtt: - BasicVirtualNode - Uid

See Also