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

Reduce boilerplate for single stack apps #46

Closed
eladb opened this issue Jun 6, 2018 · 1 comment
Closed

Reduce boilerplate for single stack apps #46

eladb opened this issue Jun 6, 2018 · 1 comment

Comments

@eladb
Copy link
Contributor

eladb commented Jun 6, 2018

It is a very common case to have CDK apps with a single stack, in which case there's currently too much boilerplate:

import { App, Stack } from 'aws-cdk'; // boilerplate
import { Topic } from '@aws-cdk/sns';
import { Table } from '@aws-cdk/dynamodb';

// boilerplate
const app = new App(process.argv);
const stack = new Stack(app, 'my-stack');

// actual interesting code
new Topic(stack, 'MyTopic');
new Table(stack, 'MyTable');

// boilerplate
process.stdout.write(app.run());

The vision is something like:

import { stack } from 'aws-cdk'; // wish we could get rid of this too, but that's ok
import { Topic } from '@aws-cdk/sns';
import { Table } from '@aws-cdk/dynamodb';

new Topic(stack, 'MyTopic');
new Table(stack, 'MyTable');

Then, don't even need to run tsc:

cdk -a my-app.ts --name my-stack synth
Resources:
  MyTopic:
    Type: AWS::SNS::Topic
  MyTable:
    Type: AWS::DynamoDB::Table
    # ...

Naturally, we need a solution that works for all supported languages.

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