Skip to content

Instantly share code, notes, and snippets.

@eladb
Created February 26, 2019 11:01
Show Gist options
  • Save eladb/26fb5f82d79a2f2df06ba8595e655bac to your computer and use it in GitHub Desktop.
Save eladb/26fb5f82d79a2f2df06ba8595e655bac to your computer and use it in GitHub Desktop.
const markets = {
  'US': { region: 'us-east-1', account: '1234' },
  'EU': { region: 'eu-west-2', account: '3333' },
};


interface MyThingProps {
  market: string;
}

class MyThing extends Construct {
  constructor(scope: cdk.Construct, id: string, props: MyThingProps) {
    super(scope, id);
    
    const env = markets[props.market];
    
    this.setContext('market', props.market'); // just for the kicks
    
    new AnalyticsStack(this, 'analytics', { env });
    new IngestionStack(this, 'ingestion', { env });
  }
}

const app = new App();
new MyThing(app, 'US', { market: 'US' });
new MyThing(app, 'EU', { market: 'EU' });

app.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment