-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the feature
Current Behavior
Currently, to add a CloudWatch log group as a destination for a Pipe, developers must manually implement the ILogDestination interface:
const logGroup = new LogGroup(this, "LogGroup", {
retention: RetentionDays.THREE_MONTHS,
removalPolicy: RemovalPolicy.DESTROY,
});
const cwLogGroupDestination: ILogDestination = {
bind: () => ({
parameters: {
cloudwatchLogsLogDestination: {
logGroupArn: logGroup.logGroupArn,
},
},
}),
grantPush: (grantee) => {
logGroup.grantWrite(grantee);
},
};
new Pipe(this, "Pipe", {
logDestinations: [cwLogGroupDestination],
});Proposed Solution
We should introduce three new L2 constructs implementing the ILogDestination interface to improve developer experience. The expected usage would be more straightforward:
const logGroup = new LogGroup(this, "LogGroup", {
retention: RetentionDays.THREE_MONTHS,
removalPolicy: RemovalPolicy.DESTROY,
});
new Pipe(this, "Pipe", {
logDestinations: [new CloudwatchLogsLogDestination(logGroup)],
});Implementation Details
We need to create three classes that implement ILogDestination, corresponding to the options defined in the LogDestinationParameters interface:
CloudwatchLogsLogDestinationFirehoseLogDestinationS3LogDestination
These class names align with the existing property names in the LogDestinationParameters interface:
/**
* Log destination configuration parameters.
*/
export interface LogDestinationParameters {
/**
* The logging configuration settings for the pipe.
*
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-cloudwatchlogslogdestination
*
* @default - none
*/
readonly cloudwatchLogsLogDestination?: CfnPipe.CloudwatchLogsLogDestinationProperty;
/**
* The Amazon Kinesis Data Firehose logging configuration settings for the pipe.
*
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-firehoselogdestination
*
* @default - none
*/
readonly firehoseLogDestination?: CfnPipe.FirehoseLogDestinationProperty;
/**
* The Amazon S3 logging configuration settings for the pipe.
*
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-s3logdestination
*
* @default - none
*/
readonly s3LogDestination?: CfnPipe.S3LogDestinationProperty;
}Use Case
This enhancement will significantly improve the developer experience when working with log destinations in CDK Pipes, making it more consistent with the expected L2 construct patterns.
Proposed Solution
No response
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
CDK version used
2.161.1
Environment details (OS name and version, etc.)
Ubuntu 24.04