AWS CloudFormation
User Guide (Version )

AWS::AppMesh::VirtualService

Creates a virtual service within a service mesh.

A virtual service is an abstraction of a real service that is provided by a virtual node directly or indirectly by means of a virtual router. Dependent services call your virtual service by its virtualServiceName, and those requests are routed to the virtual node or virtual router that is specified as the provider for the virtual service.

Syntax

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

JSON

{ "Type" : "AWS::AppMesh::VirtualService", "Properties" : { "MeshName" : String, "Spec" : VirtualServiceSpec, "Tags" : [ Tag, ... ], "VirtualServiceName" : String } }

YAML

Type: AWS::AppMesh::VirtualService Properties: MeshName: String Spec: VirtualServiceSpec Tags: - Tag VirtualServiceName: String

Properties

MeshName

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

Required: Yes

Type: String

Update requires: Replacement

Spec

The virtual service specification to apply.

Required: Yes

Type: VirtualServiceSpec

Update requires: No interruption

Tags

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

VirtualServiceName

The name to use for the virtual service.

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

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

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 service.

MeshName

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

Uid

The unique identifier for the virtual service.

VirtualServiceName

The name of the virtual service.

Examples

Create a Virtual Service

This example creates a virtual service that is provided by a virtual node.

JSON

{ "Description": "Basic Test VirtualService", "Resources": { "BasicVirtualService1": { "Type": "AWS::AppMesh::VirtualService", "Properties": { "VirtualServiceName": "TestVirtualService1.internal", "MeshName": null, "Spec": { "Provider": { "VirtualNode": { "VirtualNodeName": null } } }, "Tags": [ { "Key": "Key1", "Value": "Value1" }, { "Key": "Key2", "Value": "Value2" } ] } } }, "Outputs": { "VirtualServiceName1": { "Description": "Name of the VirtualService", "Value": { "Fn::GetAtt": [ "BasicVirtualService1", "VirtualServiceName" ] } }, "MeshName": { "Description": "Name of the Mesh", "Value": { "Fn::GetAtt": [ "BasicVirtualService1", "MeshName" ] } }, "Arn": { "Description": "Arn of the VirtualService created", "Value": { "Fn::GetAtt": [ "BasicVirtualService1", "Arn" ] } }, "Uid": { "Description": "Uid of the VirtualService created", "Value": { "Fn::GetAtt": [ "BasicVirtualService1", "Uid" ] } } } }

YAML

Description: "Basic Test VirtualService" Resources: BasicVirtualService1: Type: "AWS::AppMesh::VirtualService" Properties: VirtualServiceName: "TestVirtualService1.internal" MeshName: !ImportValue TestMeshName Spec: Provider: VirtualNode: VirtualNodeName: !ImportValue TestVirtualNodeName1 Tags: - Key: "Key1" Value: "Value1" - Key: "Key2" Value: "Value2" Outputs: VirtualServiceName1: Description: Name of the VirtualService Value: Fn::GetAtt: - BasicVirtualService1 - VirtualServiceName MeshName: Description: Name of the Mesh Value: Fn::GetAtt: - BasicVirtualService1 - MeshName Arn: Description: Arn of the VirtualService created Value: Fn::GetAtt: - BasicVirtualService1 - Arn Uid: Description: Uid of the VirtualService created Value: Fn::GetAtt: - BasicVirtualService1 - Uid

See Also