# ServiceConnectServiceProperty

The Service Connect service object configuration.

For more information, see [Service Connect](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html) in the *Amazon Elastic Container Service Developer Guide* .

- Source: Generated at build time
- Type last changed: v2.123.0 · 24 Jan 2024

## Example

TypeScript:

```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 serviceConnectServiceProperty: ecs.CfnService.ServiceConnectServiceProperty = {
  portName: 'portName',

  // the properties below are optional
  clientAliases: [{
    port: 123,

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

        // the properties below are optional
        value: {
          exact: 'exact',
        },
      },
    },
  }],
  discoveryName: 'discoveryName',
  ingressPortOverride: 123,
  timeout: {
    idleTimeoutSeconds: 123,
    perRequestTimeoutSeconds: 123,
  },
  tls: {
    issuerCertificateAuthority: {
      awsPcaAuthorityArn: 'awsPcaAuthorityArn',
    },

    // the properties below are optional
    kmsKey: 'kmsKey',
    roleArn: 'roleArn',
  },
};
```

Python:

```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_service_property = ecs.CfnService.ServiceConnectServiceProperty(
    port_name="portName",

    # the properties below are optional
    client_aliases=[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"
                )
            )
        )
    )],
    discovery_name="discoveryName",
    ingress_port_override=123,
    timeout=ecs.CfnService.TimeoutConfigurationProperty(
        idle_timeout_seconds=123,
        per_request_timeout_seconds=123
    ),
    tls=ecs.CfnService.ServiceConnectTlsConfigurationProperty(
        issuer_certificate_authority=ecs.CfnService.ServiceConnectTlsCertificateAuthorityProperty(
            aws_pca_authority_arn="awsPcaAuthorityArn"
        ),

        # the properties below are optional
        kms_key="kmsKey",
        role_arn="roleArn"
    )
)
```

Java:

```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.*;

ServiceConnectServiceProperty serviceConnectServiceProperty = ServiceConnectServiceProperty.builder()
        .portName("portName")

        // the properties below are optional
        .clientAliases(List.of(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()))
        .discoveryName("discoveryName")
        .ingressPortOverride(123)
        .timeout(TimeoutConfigurationProperty.builder()
                .idleTimeoutSeconds(123)
                .perRequestTimeoutSeconds(123)
                .build())
        .tls(ServiceConnectTlsConfigurationProperty.builder()
                .issuerCertificateAuthority(ServiceConnectTlsCertificateAuthorityProperty.builder()
                        .awsPcaAuthorityArn("awsPcaAuthorityArn")
                        .build())

                // the properties below are optional
                .kmsKey("kmsKey")
                .roleArn("roleArn")
                .build())
        .build();
```

C# / .NET:

```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 serviceConnectServiceProperty = new ServiceConnectServiceProperty {
    PortName = "portName",

    // the properties below are optional
    ClientAliases = new [] { 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"
                }
            }
        }
    } },
    DiscoveryName = "discoveryName",
    IngressPortOverride = 123,
    Timeout = new TimeoutConfigurationProperty {
        IdleTimeoutSeconds = 123,
        PerRequestTimeoutSeconds = 123
    },
    Tls = new ServiceConnectTlsConfigurationProperty {
        IssuerCertificateAuthority = new ServiceConnectTlsCertificateAuthorityProperty {
            AwsPcaAuthorityArn = "awsPcaAuthorityArn"
        },

        // the properties below are optional
        KmsKey = "kmsKey",
        RoleArn = "roleArn"
    }
};
```

Golang:

```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"

serviceConnectServiceProperty := &ServiceConnectServiceProperty{
	PortName: jsii.String("portName"),

	// the properties below are optional
	ClientAliases: []interface{}{
		&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"),
					},
				},
			},
		},
	},
	DiscoveryName: jsii.String("discoveryName"),
	IngressPortOverride: jsii.Number(123),
	Timeout: &TimeoutConfigurationProperty{
		IdleTimeoutSeconds: jsii.Number(123),
		PerRequestTimeoutSeconds: jsii.Number(123),
	},
	Tls: &ServiceConnectTlsConfigurationProperty{
		IssuerCertificateAuthority: &ServiceConnectTlsCertificateAuthorityProperty{
			AwsPcaAuthorityArn: jsii.String("awsPcaAuthorityArn"),
		},

		// the properties below are optional
		KmsKey: jsii.String("kmsKey"),
		RoleArn: jsii.String("roleArn"),
	},
}
```

## Properties

- `clientAliases`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceConnectClientAliasProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceConnectClientAliasProperty.html)[] — The list of client aliases for this Service Connect service.

  You use these to assign names that can be used by client applications. The maximum number of client aliases that you can have in this list is 1.

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

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

  For each `ServiceConnectService` , you must provide at least one `clientAlias` with one `port` .

- `discoveryName`: string — The `discoveryName` is the name of the new AWS Cloud Map service that Amazon ECS creates for this Amazon ECS service.

  This must be unique within the AWS Cloud Map namespace. The name can contain up to 64 characters. The name can include lowercase letters, numbers, underscores (_), and hyphens (-). The name can't start with a hyphen.

  If the `discoveryName` isn't specified, the port mapping name from the task definition is used in `portName.namespace` .

- `ingressPortOverride`: number — The port number for the Service Connect proxy to listen on.

  Use the value of this field to bypass the proxy for traffic on the port number specified in the named `portMapping` in the task definition of this application, and then use it in your VPC security groups to allow traffic into the proxy for this Amazon ECS service.

  In `awsvpc` mode and Fargate, the default value is the container port number. The container port number is in the `portMapping` in the task definition. In bridge mode, the default value is the ephemeral port of the Service Connect proxy.

- `portName`: string (required) — The `portName` must match the name of one of the `portMappings` from all the containers in the task definition of this Amazon ECS service.

- `timeout`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.TimeoutConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.TimeoutConfigurationProperty.html) — A reference to an object that represents the configured timeouts for Service Connect.

- `tls`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceConnectTlsConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceConnectTlsConfigurationProperty.html) — A reference to an object that represents a Transport Layer Security (TLS) configuration.
