CmdID

CmdID / aws / aws servicediscovery

aws servicediscovery get-instance

Gets information about a specified instance. AWS CLI reference

2 examples 2 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 get the details of an instance

The following get-instance example gets the attributes of a service.

aws servicediscovery get-instance --service-id srv-e4anhexample0004 --instance-id i-abcd1234Identify
--service-idThe ID or Amazon Resource Name (ARN) of the service that the instance is associated with.
--instance-idThe ID of the instance that you want to get information about.
Its output
{
    "ResourceOwner": "123456789012",
    "Instance": {
        "Id": "arn:aws:servicediscovery:us-west-2:123456789012;:service/srv-e4anhexample0004",
        "Attributes": {
            "AWS_INSTANCE_IPV4": "192.0.2.44",
            "AWS_INSTANCE_PORT": "80",
            "color": "green",
            "region": "us-west-2",
            "stage": "beta"
        },
        "CreatedByAccount": "123456789012"
    }
}

For more information, see AWS Cloud Map service instances in the AWS Cloud Map Developer Guide.

Example 2: To get the details of an instance using service ARN for shared namespaces

The following get-instance example gets the attributes of an instance using a service ARN instead of service ID. Specifying an ARN is required when getting details of instances associated with namespaces that are shared with your account. The instance returned in this example was registered by account 123456789111 in a namespace owned by account 123456789012.

aws servicediscovery get-instance --service-id arn:aws:servicediscovery:us-west-2:123456789012:service/srv-p5zdwlg5uvvzjita --instance-id web-server-01Identify
--service-idThe ID or Amazon Resource Name (ARN) of the service that the instance is associated with.
--instance-idThe ID of the instance that you want to get information about.
Its output
{
    "ResourceOwner": "123456789012",
    "Instance": {
        "Id": "web-server-01",
        "Attributes": {
            "AWS_INSTANCE_IPV4": "203.0.113.15",
            "AWS_INSTANCE_PORT": "80"
        },
        "CreatedByAccount": "123456789111"
    }
}

For more information about cross-account namespace sharing, see Shared AWS Cloud Map namespaces in the AWS Cloud Map Developer Guide.

Options

2 in the AWS CLI reference
--instance-idThe ID of the instance that you want to get information about.
--service-idThe ID or Amazon Resource Name (ARN) of the service that the instance is associated with.