# ClusterAttributes

The properties to import from the ECS cluster.

- Source: [`aws-ecs/lib/cluster.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts#L1008)
- Type last changed: v2.85.0 · 21 Jun 2023

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
import { aws_servicediscovery as servicediscovery } from 'aws-cdk-lib';
import { aws_logs as interfaces_logs } from 'aws-cdk-lib/interfaces';

declare const autoScalingGroup: autoscaling.AutoScalingGroup;
declare const bucket: s3.Bucket;
declare const key: kms.Key;
declare const logGroupRef: interfaces_logs.ILogGroupRef;
declare const namespace: servicediscovery.INamespace;
declare const securityGroup: ec2.SecurityGroup;
declare const vpc: ec2.Vpc;
const clusterAttributes: ecs.ClusterAttributes = {
  clusterName: 'clusterName',
  vpc: vpc,

  // the properties below are optional
  autoscalingGroup: autoScalingGroup,
  clusterArn: 'clusterArn',
  defaultCloudMapNamespace: namespace,
  executeCommandConfiguration: {
    kmsKey: key,
    logConfiguration: {
      cloudWatchEncryptionEnabled: false,
      cloudWatchLogGroup: logGroupRef,
      s3Bucket: bucket,
      s3EncryptionEnabled: false,
      s3KeyPrefix: 's3KeyPrefix',
    },
    logging: ecs.ExecuteCommandLogging.NONE,
  },
  hasEc2Capacity: false,
  securityGroups: [securityGroup],
};
```

## Properties

- `autoscalingGroup`: [IAutoScalingGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.IAutoScalingGroup.html) — Autoscaling group added to the cluster if capacity is added.

  **Default:** No default autoscaling group

- `clusterArn`: string — The Amazon Resource Name (ARN) that identifies the cluster.

  **Default:** Derived from clusterName

- `clusterName`: string (required) — The name of the cluster.

- `defaultCloudMapNamespace`: [INamespace](/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.INamespace.html) — The AWS Cloud Map namespace to associate with the cluster.

  **Default:** No default namespace

- `executeCommandConfiguration`: [ExecuteCommandConfiguration](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ExecuteCommandConfiguration.html) = none. — The execute command configuration for the cluster.

- `hasEc2Capacity`: boolean = true — Specifies whether the cluster has EC2 instance capacity.

- `securityGroups`: [ISecurityGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — The security groups associated with the container instances registered to the cluster.

  **Default:** no security groups

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — The VPC associated with the cluster.
