# AlternateTargetConfig

Configuration returned by AlternateTargetConfiguration.bind().

Returned by: [IAlternateTarget.bind](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.IAlternateTarget.html#bind)

- Source: [`aws-ecs/lib/alternate-target-configuration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ecs/lib/alternate-target-configuration.ts#L53)
- Type last changed: v2.211.0 · 13 Aug 2025

## 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 alternateTargetConfig: ecs.AlternateTargetConfig = {
  alternateTargetGroupArn: 'alternateTargetGroupArn',
  roleArn: 'roleArn',

  // the properties below are optional
  productionListenerRule: 'productionListenerRule',
  testListenerRule: 'testListenerRule',
};
```

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

alternate_target_config = ecs.AlternateTargetConfig(
    alternate_target_group_arn="alternateTargetGroupArn",
    role_arn="roleArn",

    # the properties below are optional
    production_listener_rule="productionListenerRule",
    test_listener_rule="testListenerRule"
)
```

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

AlternateTargetConfig alternateTargetConfig = AlternateTargetConfig.builder()
        .alternateTargetGroupArn("alternateTargetGroupArn")
        .roleArn("roleArn")

        // the properties below are optional
        .productionListenerRule("productionListenerRule")
        .testListenerRule("testListenerRule")
        .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 alternateTargetConfig = new AlternateTargetConfig {
    AlternateTargetGroupArn = "alternateTargetGroupArn",
    RoleArn = "roleArn",

    // the properties below are optional
    ProductionListenerRule = "productionListenerRule",
    TestListenerRule = "testListenerRule"
};
```

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"

alternateTargetConfig := &AlternateTargetConfig{
	AlternateTargetGroupArn: jsii.String("alternateTargetGroupArn"),
	RoleArn: jsii.String("roleArn"),

	// the properties below are optional
	ProductionListenerRule: jsii.String("productionListenerRule"),
	TestListenerRule: jsii.String("testListenerRule"),
}
```

## Properties

- `alternateTargetGroupArn`: string (required) — The ARN of the alternate target group.

- `productionListenerRule`: string = none — The production listener rule ARN (ALB) or listener ARN (NLB).

- `roleArn`: string (required) — The IAM role ARN for the configuration.

  **Default:** a new role will be created

- `testListenerRule`: string = none — The test listener rule ARN (ALB) or listener ARN (NLB).
