github.com/hobbeswalsh/terraform@v0.3.7-0.20150619183303-ad17cf55a0fa/website/source/docs/providers/aws/r/dynamodb_table.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: dynamodb_table"
     4  sidebar_current: "docs-aws-resource-dynamodb-table"
     5  description: |-
     6    Provides a DynamoDB table resource
     7  ---
     8  
     9  # aws\_dynamodb\_table
    10  
    11  Provides a DynamoDB table resource
    12  
    13  ## Example Usage
    14  
    15  The following dynamodb table description models the table and GSI shown
    16  in the [AWS SDK example documentation](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html)
    17  
    18  ```
    19  resource "aws_dynamodb_table" "basic-dynamodb-table" {
    20      name = "GameScores"
    21      read_capacity = 20
    22      write_capacity = 20
    23      hash_key = "UserId"
    24      range_key = "GameTitle"
    25      attribute {
    26        name = "Username"
    27        type = "S"
    28      }
    29      attribute {
    30        name = "GameTitle"
    31        type = "S"
    32      }
    33      attribute {
    34        name = "TopScore"
    35        type = "N"
    36      }
    37      attribute {
    38        name = "TopScoreDateTime"
    39        type = "S"
    40      }
    41      attribute {
    42        name = "Wins"
    43        type = "N"
    44      } 
    45      attribute {
    46        name = "Losses"
    47        type = "N"
    48      }
    49      global_secondary_index {
    50        name = "GameTitleIndex"
    51        hash_key = "GameTitle"
    52        range_key = "TopScore"
    53        write_capacity = 10
    54        read_capacity = 10
    55        projection_type = "INCLUDE"
    56        non_key_attributes = [ "UserId" ]
    57      }
    58  }
    59  ```
    60  
    61  ## Argument Reference
    62  
    63  The following arguments are supported:
    64  
    65  * `name` - (Required) The name of the table, this needs to be unique
    66    within a region.
    67  * `read_capacity` - (Required) The number of read units for this table
    68  * `write_capacity` - (Required) The number of write units for this table
    69  * `hash_key` - (Required) The attribute to use as the hash key (the
    70    attribute must also be defined as an attribute record
    71  * `range_key` - (Optional) The attribute to use as the range key (must
    72    also be defined)
    73  * `attribute` - Define an attribute, has two properties:
    74    * `name` - The name of the attribute
    75    * `type` - One of: S, N, or B for (S)tring, (N)umber or (B)inary data
    76  * `local_secondary_index` - (Optional) Describe an LSI on the table;
    77    these can only be allocated *at creation* so you cannot change this
    78  definition after you have created the resource. 
    79  * `global_secondary_index` - (Optional) Describe a GSO for the table;
    80    subject to the normal limits on the number of GSIs, projected
    81  attributes, etc.  
    82  
    83  For both `local_secondary_index` and `global_secondary_index` objects,
    84  the following properties are supported:
    85  
    86  * `name` - (Required) The name of the LSI or GSI
    87  * `hash_key` - (Required) The name of the hash key in the index; must be
    88    defined as an attribute in the resource
    89  * `range_key` - (Required) The name of the range key; must be defined
    90  * `projection_type` - (Required) One of "ALL", "INCLUDE" or "KEYS_ONLY"
    91     where *ALL* projects every attribute into the index, *KEYS_ONLY*
    92      projects just the hash and range key into the index, and *INCLUDE*
    93      projects only the keys specified in the _non_key_attributes_
    94  parameter. 
    95  * `non_key_attributes` - (Optional) Only required with *INCLUDE* as a
    96    projection type; a list of attributes to project into the index. For
    97  each attribute listed, you need to make sure that it has been defined in
    98  the table object. 
    99  
   100  For `global_secondary_index` objects only, you need to specify
   101  `write_capacity` and `read_capacity` in the same way you would for the
   102  table as they have separate I/O capacity.
   103  
   104  ## Attributes Reference
   105  
   106  The following attributes are exported:
   107  
   108  * `id` - The name of the table
   109