AWSTemplateFormatVersion: '2010-09-09' Description: (AWS Heidi) Storage stack to create dynamodb table Parameters: secondaryRegion: Type: String Description: Optional Enter name of secondary region, leave black if its single region deployment isPrimaryRegion: Type: String Description: Is this a primary region (Y/N) Resources: EventHealthDDBTable: Condition: isPrimaryRegion Type: AWS::DynamoDB::GlobalTable Properties: TableName: !Sub "EventHealthDDBTable-${AWS::AccountId}" AttributeDefinitions: - AttributeName: eventArn AttributeType: S KeySchema: - AttributeName: eventArn KeyType: HASH BillingMode: PAY_PER_REQUEST StreamSpecification: StreamViewType: NEW_IMAGE Replicas: - Region: !Sub "${AWS::Region}" - !If - secondaryRegion - Region: !Ref secondaryRegion - !Ref "AWS::NoValue" Outputs: EventHealthDDBTable: Value: !Sub "EventHealthDDBTable-${AWS::AccountId}" Export: Name: EventHealthDDBTable EventHealthDDBTableArn: Value: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/EventHealthDDBTable-${AWS::AccountId} Export: Name: EventHealthDDBTableArn Conditions: isPrimaryRegion: !Equals [!Ref isPrimaryRegion, "Y"] secondaryRegion: !Not [!Equals [!Ref secondaryRegion, ""]]