Skip to content

Instantly share code, notes, and snippets.

@moofish32
Created October 26, 2018 21:11
Show Gist options
  • Save moofish32/bec1ad0b9b12b779cb05e1ae5ff381ed to your computer and use it in GitHub Desktop.
Save moofish32/bec1ad0b9b12b779cb05e1ae5ff381ed to your computer and use it in GitHub Desktop.
import dyn = require('@aws-cdk/aws-dynamodb');
import cdk = require('@aws-cdk/cdk');
export class DynamoExport extends cdk.Stack {
public readonly tableNameOutput: cdk.Output;
public readonly tableArnOutput: cdk.Output;
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);
const tbl = new dyn.Table(this, 'TableMe', {
tableName: 'MyTableName'
});
this.tableNameOutput = new cdk.Output(this, 'TableName', {
value: tbl.tableName,
});
this.tableArnOutput = new cdk.Output(this, 'TableName', {
value: tbl.tableArn,
});
}
}
const app = new cdk.App();
const dynamoStack = new DynamoExport(app, 'Dynamo');
// places where you want to import the value use:
dynamoStack.tableArnOutput.makeImportValue();
dynamoStack.tableNameOutput.makeImportValue();
app.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment