<s> from troposphere import Template , Ref , Output , Parameter <EOL> from troposphere . dynamodb import ( Key , AttributeDefinition , <EOL> ProvisionedThroughput , Projection ) <EOL> from troposphere . dynamodb import Table , GlobalSecondaryIndex <EOL> template = Template ( ) <EOL> template . add_description ( "<STR_LIT>" <EOL> "<STR_LIT:index>" ) <EOL> readunits = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT>" , <EOL> MinValue = "<STR_LIT:5>" , <EOL> MaxValue = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> writeunits = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:5>" , <EOL> MinValue = "<STR_LIT:5>" , <EOL> MaxValue = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> tableIndexName = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:id>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> tableIndexDataType = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:S>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT:1>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexHashName = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexHashDataType = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:S>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT:1>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexRangeName = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexRangeDataType = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:S>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT:1>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) ) <EOL> GSITable = template . add_resource ( Table ( <EOL> "<STR_LIT>" , <EOL> AttributeDefinitions = [ <EOL> AttributeDefinition ( Ref ( tableIndexName ) , Ref ( tableIndexDataType ) ) , <EOL> AttributeDefinition ( Ref ( secondaryIndexHashName ) , <EOL> Ref ( secondaryIndexHashDataType ) ) , <EOL> AttributeDefinition ( Ref ( secondaryIndexRangeName ) , <EOL> Ref ( secondaryIndexRangeDataType ) ) , <EOL> AttributeDefinition ( "<STR_LIT>" , "<STR_LIT:S>" ) , <EOL> AttributeDefinition ( "<STR_LIT>" , "<STR_LIT:S>" ) <EOL> ] , <EOL> KeySchema = [ <EOL> Key ( Ref ( tableIndexName ) , "<STR_LIT>" ) <EOL> ] , <EOL> ProvisionedThroughput = ProvisionedThroughput ( <EOL> Ref ( readunits ) , <EOL> Ref ( writeunits ) <EOL> ) , <EOL> GlobalSecondaryIndexes = [ <EOL> GlobalSecondaryIndex ( <EOL> "<STR_LIT>" , <EOL> [ <EOL> Key ( Ref ( secondaryIndexHashName ) , "<STR_LIT>" ) , <EOL> Key ( Ref ( secondaryIndexRangeName ) , "<STR_LIT>" ) <EOL> ] , <EOL> Projection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) , <EOL> ProvisionedThroughput ( <EOL> Ref ( readunits ) , <EOL> Ref ( writeunits ) <EOL> ) <EOL> ) <EOL> ] <EOL> ) ) <EOL> template . add_output ( Output ( <EOL> "<STR_LIT>" , <EOL> Value = Ref ( GSITable ) , <EOL> Description = "<STR_LIT>" , <EOL> ) ) <EOL> print ( template . to_json ( ) ) </s>
