Skip to content
v2.277.0

ServiceConnectClientAliasProperty Struct ​

Each alias ("endpoint") is a fully-qualified name and port number that other tasks ("clients") can use to connect to this service.

Each name and port mapping must be unique within the namespace.

Tasks that run in a namespace can use short names to connect to services in the namespace. Tasks can connect to services across all of the clusters in the namespace. Tasks connect through a managed proxy container that collects logs and metrics for increased visibility. Only the tasks that Amazon ECS services create are supported with Service Connect. For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const serviceConnectClientAliasProperty: ecs.CfnService.ServiceConnectClientAliasProperty = {
  port: 123,

  // the properties below are optional
  dnsName: 'dnsName',
  testTrafficRules: {
    header: {
      name: 'name',

      // the properties below are optional
      value: {
        exact: 'exact',
      },
    },
  },
};
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_ecs as ecs

service_connect_client_alias_property = ecs.CfnService.ServiceConnectClientAliasProperty(
    port=123,

    # the properties below are optional
    dns_name="dnsName",
    test_traffic_rules=ecs.CfnService.ServiceConnectTestTrafficRulesProperty(
        header=ecs.CfnService.ServiceConnectTestTrafficRulesHeaderProperty(
            name="name",

            # the properties below are optional
            value=ecs.CfnService.ServiceConnectTestTrafficRulesHeaderValueProperty(
                exact="exact"
            )
        )
    )
)
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.ecs.*;

ServiceConnectClientAliasProperty serviceConnectClientAliasProperty = ServiceConnectClientAliasProperty.builder()
        .port(123)

        // the properties below are optional
        .dnsName("dnsName")
        .testTrafficRules(ServiceConnectTestTrafficRulesProperty.builder()
                .header(ServiceConnectTestTrafficRulesHeaderProperty.builder()
                        .name("name")

                        // the properties below are optional
                        .value(ServiceConnectTestTrafficRulesHeaderValueProperty.builder()
                                .exact("exact")
                                .build())
                        .build())
                .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.ECS;

var serviceConnectClientAliasProperty = new ServiceConnectClientAliasProperty {
    Port = 123,

    // the properties below are optional
    DnsName = "dnsName",
    TestTrafficRules = new ServiceConnectTestTrafficRulesProperty {
        Header = new ServiceConnectTestTrafficRulesHeaderProperty {
            Name = "name",

            // the properties below are optional
            Value = new ServiceConnectTestTrafficRulesHeaderValueProperty {
                Exact = "exact"
            }
        }
    }
};
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"

serviceConnectClientAliasProperty := &ServiceConnectClientAliasProperty{
	Port: jsii.Number(123),

	// the properties below are optional
	DnsName: jsii.String("dnsName"),
	TestTrafficRules: &ServiceConnectTestTrafficRulesProperty{
		Header: &ServiceConnectTestTrafficRulesHeaderProperty{
			Name: jsii.String("name"),

			// the properties below are optional
			Value: &ServiceConnectTestTrafficRulesHeaderValueProperty{
				Exact: jsii.String("exact"),
			},
		},
	},
}

Properties ​

dnsNameoptionalstringdns_nameoptionalstrdnsNameoptionalStringDnsNameoptionalstringDnsNameoptional*string #
The `dnsName` is the name that you use in the applications of client tasks to connect to this service.
notes

The name must be a valid DNS name but doesn't need to be fully-qualified. The name can include up to 127 characters. The name can include lowercase letters, numbers, underscores (_), hyphens (-), and periods (.). The name can't start with a hyphen.

If this parameter isn't specified, the default value of discoveryName.namespace is used. If the discoveryName isn't specified, the port mapping name from the task definition is used in portName.namespace .

To avoid changing your applications in client Amazon ECS services, set this to the same name that the client application uses by default. For example, a few common names are database , db , or the lowercase name of a database, such as mysql or redis . For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .

portnumberportint | floatportNumberPortdoublePort*float64 required #
The listening port number for the Service Connect proxy.
notes

This port is available inside of all of the tasks within the same namespace.

To avoid changing your applications in client Amazon ECS services, set this to the same port that the client application uses by default. For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .

testTrafficRulesoptionalIResolvable | CfnService.ServiceConnectTestTrafficRulesPropertytest_traffic_rulesoptionaltyping.Union[IResolvable, ServiceConnectTestTrafficRulesProperty]testTrafficRulesoptionalIResolvableTestTrafficRulesoptionalIResolvableTestTrafficRulesoptionalinterface{} #
The configuration for test traffic routing rules used during blue/green deployments with Amazon ECS Service Connect.

This allows you to route a portion of traffic to the new service revision of your service for testing before shifting all production traffic.