Created
October 26, 2018 21:11
-
-
Save moofish32/bec1ad0b9b12b779cb05e1ae5ff381ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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