CmdID

CmdID / aws / aws appmesh

aws appmesh create-virtual-service

Creates a virtual service within a service mesh. AWS CLI reference

2 examples 6 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To create a new virtual service with a virtual node provider

The following create-virtual-service example uses a JSON input file to create a virtual service with a virtual node provider.

aws appmesh create-virtual-service --cli-input-json file://create-virtual-service-virtual-node.jsonIdentify

Contents of create-virtual-service-virtual-node.json:

{
    "meshName": "app1",
    "spec": {
        "provider": {
            "virtualNode": {
                "virtualNodeName": "vnServiceA"
            }
        }
    },
    "virtualServiceName": "serviceA.svc.cluster.local"
}
Its output
{
    "virtualService": {
        "meshName": "app1",
        "metadata": {
            "arn": "arn:aws:appmesh:us-west-2:123456789012:mesh/app1/virtualService/serviceA.svc.cluster.local",
            "createdAt": 1563810859.474,
            "lastUpdatedAt": 1563810967.179,
            "uid": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
            "version": 2
        },
        "spec": {
            "provider": {
                "virtualNode": {
                    "virtualNodeName": "vnServiceA"
                }
            }
        },
        "status": {
            "status": "ACTIVE"
        },
        "virtualServiceName": "serviceA.svc.cluster.local"
    }
}

For more information, see Virtual Node in the AWS App Mesh User Guide.

Example 2: To create a new virtual service with a virtual router provider

The following create-virtual-service example uses a JSON input file to create a virtual service with a virtual router provider.

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

Contents of create-virtual-service-virtual-router.json:

{
    "meshName": "app1",
    "spec": {
        "provider": {
            "virtualRouter": {
                "virtualRouterName": "vrServiceB"
            }
        }
    },
    "virtualServiceName": "serviceB.svc.cluster.local"
}
Its output
{
    "virtualService": {
        "meshName": "app1",
        "metadata": {
            "arn": "arn:aws:appmesh:us-west-2:123456789012:mesh/app1/virtualService/serviceB.svc.cluster.local",
            "createdAt": 1563908363.999,
            "lastUpdatedAt": 1563908363.999,
            "uid": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
            "version": 1
        },
        "spec": {
            "provider": {
                "virtualRouter": {
                    "virtualRouterName": "vrServiceB"
                }
            }
        },
        "status": {
            "status": "ACTIVE"
        },
        "virtualServiceName": "serviceB.svc.cluster.local"
    }
}

For more information, see Virtual Services in the AWS App Mesh User Guide

Options

6 in the AWS CLI reference
--client-tokenUnique, case-sensitive identifier that you provide to ensure the idempotency of the request.
--mesh-nameThe name of the service mesh to create the virtual service in.
--mesh-ownerThe Amazon Web Services IAM account ID of the service mesh owner.
--specThe virtual service specification to apply.
--tagsOptional metadata that you can apply to the virtual service to assist with categorization and organization.
--virtual-service-nameThe name to use for the virtual service.