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

Feature Request: Publish the Broker as a CDK Construct Lib #2

Open
misterjoshua opened this issue Aug 16, 2022 · 0 comments
Open

Feature Request: Publish the Broker as a CDK Construct Lib #2

misterjoshua opened this issue Aug 16, 2022 · 0 comments

Comments

@misterjoshua
Copy link

misterjoshua commented Aug 16, 2022

Please publish the MerLoc Broker as an AWS CDK v2 Construct Lib.

Use Case

We'd like to add the MerLoc Broker to our existing CDK App so that it comes for free in our developers' environments. This would simplify MerLoc's setup for our entire team.

Example

/** Use the MerLocBroker's addLambdaFunction */
export class MyStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps = {}) {
    super(scope, id, props);

    // I add a MerLoc broker to my existing app.
    const merLocBroker = new MerLocBroker(this, 'MerLocBroker');

    // Lets say I have a specific function I want to configure to use the broker.
    const handler = new aws_lambda.Function(this, 'MyFunction', {...});
    // I add the lambda function to the MerLocBroker, and this auto-configures
    // the function with the correct layer and environment variables to use the broker.
    merLocBroker.addLambdaFunction(handler);
  }
}

/** An aspect-based approach */
export class MyStack2 extends Stack {
  constructor(scope: Construct, id: string, props: StackProps = {}) {
    super(scope, id, props);

    // Lets say this is my app - I have data and control planes.
    const myAppData = new MyAppData(this, 'MyAppData');
    new MyAppControl(this, 'MyAppControl', {
      myAppData,
    });

    // I add a MerLoc broker to my existing app.
    const merLocBroker = new MerLocBroker(this, 'MerLocBroker');
    // Then add an aspect that auto-configures all my lambdas with the correct
    // layer and environment variables to use the broker.
    Aspects.of(this).add(
      new MerLocConfigAspect(merLocBroker),
    );
  }
}
@misterjoshua misterjoshua changed the title Feature Request: Expose the broker as a CDK Construct Lib Feature Request: Publish the Broker as a CDK Construct Lib Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant