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-events-targets] Add CDK support for Event Bridge Firehose target #10349

Closed
1 of 2 tasks
cheruvian opened this issue Sep 14, 2020 · 1 comment · Fixed by #10400
Closed
1 of 2 tasks

[aws-events-targets] Add CDK support for Event Bridge Firehose target #10349

cheruvian opened this issue Sep 14, 2020 · 1 comment · Fixed by #10400
Assignees
Labels
@aws-cdk/aws-events-targets effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p1

Comments

@cheruvian
Copy link
Contributor

AWS Event Bridge supports Firehose target, but that is missing from the CDK constructs. This is not the same as Kinesis stream since it uses different permissions and is a different L1 CDK construct.

Use Case

Use Firehose with Event Bridge in the CDK.

Proposed Solution

Add the following:

import * as events from '@aws-cdk/aws-events';
import { singletonEventRole } from '@aws-cdk/aws-events-targets/lib/util'
import { CfnDeliveryStream } from '@aws-cdk/aws-kinesisfirehose'
import * as iam from '@aws-cdk/aws-iam';


/**
 * Customize the Kinesis Stream Event Target
 */
export interface FirehoseStreamProps {
  /**
   * The message to send to the stream.
   *
   * Must be a valid JSON text passed to the target stream.
   *
   * @default - the entire CloudWatch event
   */
  readonly message?: events.RuleTargetInput;
}


export class FirehoseStream implements events.IRuleTarget {

  constructor(private readonly stream: CfnDeliveryStream, private readonly props: FirehoseStreamProps = {}) {
  }

  /**
   * Returns a RuleTarget that can be used to trigger this Kinesis Stream as a
   * result from a CloudWatch event.
   */
  public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig {
    const policyStatements = [new iam.PolicyStatement({
      actions: ['firehose:PutRecord', 'firehose:PutRecordBatch'],
      resources: [this.stream.attrArn],
    })];

    return {
      id: '',
      arn: this.stream.attrArn,
      role: singletonEventRole(this.stream, policyStatements),
      input: this.props.message,
      targetResource: this.stream
    };
  }
}

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@cheruvian cheruvian added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Sep 14, 2020
@shivlaks shivlaks added effort/medium Medium work item – several days of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 15, 2020
cheruvian added a commit to cheruvian/aws-cdk that referenced this issue Sep 16, 2020
cheruvian added a commit to cheruvian/aws-cdk that referenced this issue Sep 16, 2020
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Sep 16, 2020
@mergify mergify bot closed this as completed in #10400 Oct 20, 2020
mergify bot pushed a commit that referenced this issue Oct 20, 2020
…10400)

closes #10349


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-events-targets effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants