Skip to content
v2.278.0

ServiceDiscoveryConfig Struct ​

Properties for VirtualNode Service Discovery.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appmesh as appmesh } from 'aws-cdk-lib';
const serviceDiscoveryConfig: appmesh.ServiceDiscoveryConfig = {
  cloudmap: {
    namespaceName: 'namespaceName',
    serviceName: 'serviceName',

    // the properties below are optional
    attributes: [{
      key: 'key',
      value: 'value',
    }],
    ipPreference: 'ipPreference',
  },
  dns: {
    hostname: 'hostname',

    // the properties below are optional
    ipPreference: 'ipPreference',
    responseType: 'responseType',
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appmesh as appmesh

service_discovery_config = appmesh.ServiceDiscoveryConfig(
    cloudmap=appmesh.CfnVirtualNode.AwsCloudMapServiceDiscoveryProperty(
        namespace_name="namespaceName",
        service_name="serviceName",

        # the properties below are optional
        attributes=[appmesh.CfnVirtualNode.AwsCloudMapInstanceAttributeProperty(
            key="key",
            value="value"
        )],
        ip_preference="ipPreference"
    ),
    dns=appmesh.CfnVirtualNode.DnsServiceDiscoveryProperty(
        hostname="hostname",

        # the properties below are optional
        ip_preference="ipPreference",
        response_type="responseType"
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appmesh.*;

ServiceDiscoveryConfig serviceDiscoveryConfig = ServiceDiscoveryConfig.builder()
        .cloudmap(AwsCloudMapServiceDiscoveryProperty.builder()
                .namespaceName("namespaceName")
                .serviceName("serviceName")

                // the properties below are optional
                .attributes(List.of(AwsCloudMapInstanceAttributeProperty.builder()
                        .key("key")
                        .value("value")
                        .build()))
                .ipPreference("ipPreference")
                .build())
        .dns(DnsServiceDiscoveryProperty.builder()
                .hostname("hostname")

                // the properties below are optional
                .ipPreference("ipPreference")
                .responseType("responseType")
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppMesh;

var serviceDiscoveryConfig = new ServiceDiscoveryConfig {
    Cloudmap = new AwsCloudMapServiceDiscoveryProperty {
        NamespaceName = "namespaceName",
        ServiceName = "serviceName",

        // the properties below are optional
        Attributes = new [] { new AwsCloudMapInstanceAttributeProperty {
            Key = "key",
            Value = "value"
        } },
        IpPreference = "ipPreference"
    },
    Dns = new DnsServiceDiscoveryProperty {
        Hostname = "hostname",

        // the properties below are optional
        IpPreference = "ipPreference",
        ResponseType = "responseType"
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

serviceDiscoveryConfig := &ServiceDiscoveryConfig{
	Cloudmap: &AwsCloudMapServiceDiscoveryProperty{
		NamespaceName: jsii.String("namespaceName"),
		ServiceName: jsii.String("serviceName"),

		// the properties below are optional
		Attributes: []interface{}{
			&AwsCloudMapInstanceAttributeProperty{
				Key: jsii.String("key"),
				Value: jsii.String("value"),
			},
		},
		IpPreference: jsii.String("ipPreference"),
	},
	Dns: &DnsServiceDiscoveryProperty{
		Hostname: jsii.String("hostname"),

		// the properties below are optional
		IpPreference: jsii.String("ipPreference"),
		ResponseType: jsii.String("responseType"),
	},
}

Properties ​

Cloud Map based Service Discovery.

Default: no Cloud Map based service discovery

DNS based Service Discovery.

Default: no DNS based service discovery