ExecuteCommandLogging

class aws_cdk.aws_ecs.ExecuteCommandLogging(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

The log settings to use to for logging the execute command session.

For more information, see [Logging] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-executecommandconfiguration.html#cfn-ecs-cluster-executecommandconfiguration-logging

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc

kms_key = kms.Key(self, "KmsKey")

# Pass the KMS key in the `encryptionKey` field to associate the key to the log group
log_group = logs.LogGroup(self, "LogGroup",
    encryption_key=kms_key
)

# Pass the KMS key in the `encryptionKey` field to associate the key to the S3 bucket
exec_bucket = s3.Bucket(self, "EcsExecBucket",
    encryption_key=kms_key
)

cluster = ecs.Cluster(self, "Cluster",
    vpc=vpc,
    execute_command_configuration=ecs.ExecuteCommandConfiguration(
        kms_key=kms_key,
        log_configuration=ecs.ExecuteCommandLogConfiguration(
            cloud_watch_log_group=log_group,
            cloud_watch_encryption_enabled=True,
            s3_bucket=exec_bucket,
            s3_encryption_enabled=True,
            s3_key_prefix="exec-command-output"
        ),
        logging=ecs.ExecuteCommandLogging.OVERRIDE
    )
)

Attributes

DEFAULT

The awslogs configuration in the task definition is used.

If no logging parameter is specified, it defaults to this value. If no awslogs log driver is configured in the task definition, the output won’t be logged.

NONE

The execute command session is not logged.

OVERRIDE

Specify the logging details as a part of logConfiguration.