ClusterAttributes

class aws_cdk.aws_ecs.ClusterAttributes(*, cluster_name, vpc, autoscaling_group=None, cluster_arn=None, default_cloud_map_namespace=None, execute_command_configuration=None, has_ec2_capacity=None, security_groups=None)

Bases: object

The properties to import from the ECS cluster.

Parameters:
  • cluster_name (str) – The name of the cluster.

  • vpc (IVpc) – The VPC associated with the cluster.

  • autoscaling_group (Optional[IAutoScalingGroup]) – Autoscaling group added to the cluster if capacity is added. Default: - No default autoscaling group

  • cluster_arn (Optional[str]) – The Amazon Resource Name (ARN) that identifies the cluster. Default: Derived from clusterName

  • default_cloud_map_namespace (Optional[INamespace]) – The AWS Cloud Map namespace to associate with the cluster. Default: - No default namespace

  • execute_command_configuration (Union[ExecuteCommandConfiguration, Dict[str, Any], None]) – The execute command configuration for the cluster. Default: - none.

  • has_ec2_capacity (Optional[bool]) – Specifies whether the cluster has EC2 instance capacity. Default: true

  • security_groups (Optional[Sequence[ISecurityGroup]]) – The security groups associated with the container instances registered to the cluster. Default: - no security groups

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_autoscaling as autoscaling
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_ecs as ecs
from aws_cdk import aws_kms as kms
from aws_cdk import aws_logs as logs
from aws_cdk import aws_s3 as s3
from aws_cdk import aws_servicediscovery as servicediscovery

# auto_scaling_group: autoscaling.AutoScalingGroup
# bucket: s3.Bucket
# key: kms.Key
# log_group: logs.LogGroup
# namespace: servicediscovery.INamespace
# security_group: ec2.SecurityGroup
# vpc: ec2.Vpc

cluster_attributes = ecs.ClusterAttributes(
    cluster_name="clusterName",
    vpc=vpc,

    # the properties below are optional
    autoscaling_group=auto_scaling_group,
    cluster_arn="clusterArn",
    default_cloud_map_namespace=namespace,
    execute_command_configuration=ecs.ExecuteCommandConfiguration(
        kms_key=key,
        log_configuration=ecs.ExecuteCommandLogConfiguration(
            cloud_watch_encryption_enabled=False,
            cloud_watch_log_group=log_group,
            s3_bucket=bucket,
            s3_encryption_enabled=False,
            s3_key_prefix="s3KeyPrefix"
        ),
        logging=ecs.ExecuteCommandLogging.NONE
    ),
    has_ec2_capacity=False,
    security_groups=[security_group]
)

Attributes

autoscaling_group

Autoscaling group added to the cluster if capacity is added.

Default:
  • No default autoscaling group

cluster_arn

The Amazon Resource Name (ARN) that identifies the cluster.

Default:

Derived from clusterName

cluster_name

The name of the cluster.

default_cloud_map_namespace

The AWS Cloud Map namespace to associate with the cluster.

Default:
  • No default namespace

execute_command_configuration

The execute command configuration for the cluster.

Default:
  • none.

has_ec2_capacity

Specifies whether the cluster has EC2 instance capacity.

Default:

true

security_groups

The security groups associated with the container instances registered to the cluster.

Default:
  • no security groups

vpc

The VPC associated with the cluster.