Skip to content
v2.274.0

ClusterAttributes Struct ​

The properties to import from the ECS cluster.

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 ​

autoscalingGroupoptionalIAutoScalingGroupautoscaling_groupoptionalIAutoScalingGroupautoscalingGroupoptionalIAutoScalingGroupAutoscalingGroupoptionalIAutoScalingGroupAutoscalingGroupoptionalIAutoScalingGroup#
Autoscaling group added to the cluster if capacity is added.

Default: No default autoscaling group

clusterArnoptionalstringcluster_arnoptionalstrclusterArnoptionalStringClusterArnoptionalstringClusterArnoptional*string#
The Amazon Resource Name (ARN) that identifies the cluster.

Default: Derived from clusterName

clusterNamestringcluster_namestrclusterNameStringClusterNamestringClusterName*stringrequired#
The name of the cluster.
defaultCloudMapNamespaceoptionalINamespacedefault_cloud_map_namespaceoptionalINamespacedefaultCloudMapNamespaceoptionalINamespaceDefaultCloudMapNamespaceoptionalINamespaceDefaultCloudMapNamespaceoptionalINamespace#
The AWS Cloud Map namespace to associate with the cluster.

Default: No default namespace

executeCommandConfigurationoptionalExecuteCommandConfigurationexecute_command_configurationoptionalExecuteCommandConfigurationexecuteCommandConfigurationoptionalExecuteCommandConfigurationExecuteCommandConfigurationoptionalExecuteCommandConfigurationExecuteCommandConfigurationoptionalExecuteCommandConfiguration= none.#
The execute command configuration for the cluster.
hasEc2Capacityoptionalbooleanhas_ec2_capacityoptionalboolhasEc2CapacityoptionalBooleanHasEc2CapacityoptionalboolHasEc2Capacityoptional*bool= true#
Specifies whether the cluster has EC2 instance capacity.
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup#
The security groups associated with the container instances registered to the cluster.

Default: no security groups

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC associated with the cluster.