Carova
Serverless AWS CloudFormation Output Stack Variables
Export AWS CloudFormation Stack variables so that other AWS CloudFormation Stacks can reference them. Learn how to export a DynamoDB Table name, arn, and streamArn.
Add the following to the resources section of your Serverless YAML file:
1resources:
2 Resources:
3 DynamoTable:
4 Type: AWS::DynamoDB::Table
5 Properties:
6 TableName: ${self:service}-${opt:stage, self:provider.stage}-dynamo-db-table
7 BillingMode: PAY_PER_REQUEST
8 AttributeDefinitions:
9 - AttributeName: id
10 AttributeType: S
11 KeySchema:
12 - AttributeName: id
13 KeyType: HASH
14 StreamSpecification:
15 StreamViewType: NEW_AND_OLD_IMAGES
16
17
18 Outputs:
19 DynamoTableName:
20 Value: { Ref: DynamoTable }
21 DynamoTableArn:
22 Value: { Fn::GetAtt: [DynamoTable, Arn] }
23 DynamoTableStreamArn:
24 Value: { Fn::GetAtt: [DynamoTable, StreamArn] }