Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@aws-cdk/aws-pipes-alpha: add missing L2 constructs that implement ILogDestination interface #31671

Open
2 tasks
garysassano opened this issue Oct 6, 2024 · 0 comments · May be fixed by #31672
Open
2 tasks
Labels
@aws-cdk/aws-logs Related to Amazon CloudWatch Logs effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@garysassano
Copy link

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:

  1. CloudwatchLogsLogDestination
  2. FirehoseLogDestination
  3. S3LogDestination

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

@garysassano garysassano added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 6, 2024
@github-actions github-actions bot added the @aws-cdk/aws-logs Related to Amazon CloudWatch Logs label Oct 6, 2024
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Oct 6, 2024
@msambol msambol linked a pull request Oct 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-logs Related to Amazon CloudWatch Logs effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants