aws-cdk-lib.aws_ecs.ExecuteCommandLogging

enum ExecuteCommandLogging

LanguageType name
.NETAmazon.CDK.AWS.ECS.ExecuteCommandLogging
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecs#ExecuteCommandLogging
Javasoftware.amazon.awscdk.services.ecs.ExecuteCommandLogging
Pythonaws_cdk.aws_ecs.ExecuteCommandLogging
TypeScript (source)aws-cdk-lib » aws_ecs » ExecuteCommandLogging

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

Example

declare const vpc: ec2.Vpc;
const kmsKey = new kms.Key(this, 'KmsKey');

// Pass the KMS key in the `encryptionKey` field to associate the key to the log group
const logGroup = new logs.LogGroup(this, 'LogGroup', {
  encryptionKey: kmsKey,
});

// Pass the KMS key in the `encryptionKey` field to associate the key to the S3 bucket
const execBucket = new s3.Bucket(this, 'EcsExecBucket', {
  encryptionKey: kmsKey,
});

const cluster = new ecs.Cluster(this, 'Cluster', {
  vpc,
  executeCommandConfiguration: {
    kmsKey,
    logConfiguration: {
      cloudWatchLogGroup: logGroup,
      cloudWatchEncryptionEnabled: true,
      s3Bucket: execBucket,
      s3EncryptionEnabled: true,
      s3KeyPrefix: 'exec-command-output',
    },
    logging: ecs.ExecuteCommandLogging.OVERRIDE,
  },
});

Members

NameDescription
NONEThe execute command session is not logged.
DEFAULTThe awslogs configuration in the task definition is used.
OVERRIDESpecify the logging details as a part of logConfiguration.

NONE

The execute command session is not logged.


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.


OVERRIDE

Specify the logging details as a part of logConfiguration.