AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Adds a new Amazon DynamoDB global or local secondary index schema property to the supplied TableSchema object.

Syntax

LocalIndex (Default)

Add-DDBIndexSchema
-IndexName <String>
-Schema <TableSchema>
-RangeKeyName <String>
-RangeKeyDataType <ScalarAttributeType>
-ProjectionType <ProjectionType>
-NonKeyAttribute <String[]>

GlobalIndex

Add-DDBIndexSchema
-IndexName <String>
-Schema <TableSchema>
-RangeKeyName <String>
-RangeKeyDataType <ScalarAttributeType>
-ProjectionType <ProjectionType>
-NonKeyAttribute <String[]>
-Global <SwitchParameter>
-HashKeyName <String>
-HashKeyDataType <ScalarAttributeType>
-ReadCapacity <Int64>
-WriteCapacity <Int64>

Description

Adds a new Amazon DynamoDB local or global secondary index schema property to the supplied object, or returns a new object initialized with the index schema. The default behavior of this cmdlet is to create a local secondary index. To specify that the index is global, use the -Global switch and also add the ReadCapacity and WriteCapacity parameters to indicate the required throughput for the index.

Parameters

-Global <SwitchParameter>
If set, specifies that the index components described by the parameters should be added as a global secondary index entry. The ReadCapacity and WriteCapacity parameters are also required when defining a global index.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-HashKeyDataType <ScalarAttributeType>
The data type of the hash key for the global index, as specified by the Amazon DynamoDB api.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-HashKeyName <String>
The name of the hash key for the global secondary index.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-IndexName <String>
The name of the secondary index. Must be unique only for this table that will be created. If an index with the same name already exists on the pipelined object an error is thrown.
Required?True
Position?1
Accept pipeline input?True (ByPropertyName)
-NonKeyAttribute <String[]>
A collection of one or more non-key attribute names that are projected into the index. The total count of attributes specified in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ProjectionType <ProjectionType>
Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Valid values: KEYS_ONLY - Only the index and primary keys are projected into the index. INCLUDE - Only the specified table attributes are projected into the index. The list of projected attributes are specified with the -NonKeyAttribute parameter. ALL - All of the table attributes are projected into the index.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-RangeKeyDataType <ScalarAttributeType>
The data type of the range key as specified by the Amazon DynamoDB api. This is a mandatory parameter for local indexes. Global indexes can be defined with either a range key or a hash key, either of which can be any attribute in the table.
Required?True (LocalIndex)
Position?Named
Accept pipeline input?True (ByPropertyName)
-RangeKeyName <String>
The name of the range key to add to the secondary index. This is a mandatory parameter for local indexes. Global indexes can be defined with either a range key or a hash key, either of which can be any attribute in the table.
Required?True (LocalIndex)
Position?Named
Accept pipeline input?True (ByPropertyName)
-ReadCapacity <Int64>
The provisioned throughput setting for read operations on the secondary index if the index is global (the -Global switch is specified). Ignored for local secondary indexes (the default).
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Schema <TableSchema>
A previously constructed TableSchema object to which the new index schema element will be added.
Required?True
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-WriteCapacity <Int64>
The provisioned throughput setting for write operations on the secondary index if the index is global (the -Global switch is specified). Ignored for local secondary indexes (the default).
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)

Outputs

This cmdlet returns an updated Amazon.PowerShell.Cmdlets.DDB.Model.TableSchema object to the pipeline.

Examples

Example 1

$schema | Add-DDBIndexSchema -IndexName "LastPostIndex" -RangeKeyName "LastPostDateTime" -RangeKeyDataType "S" -ProjectionType "keys_only"
$schema = New-DDBTableSchema

AttributeSchema KeySchema LocalSecondaryIndexSchema
--------------- --------- -------------------------
{LastPostDateTime} {} {LastPostIndex}
Creates an empty TableSchema object and adds a new local secondary index definition to it before writing the TableSchema object to the pipeline.

Example 2

New-DDBTableSchema | Add-DDBIndexSchema -IndexName "LastPostIndex" -RangeKeyName "LastPostDateTime" -RangeKeyDataType "S" -ProjectionType "keys_only"

AttributeSchema KeySchema LocalSecondaryIndexSchema
--------------- --------- -------------------------
{LastPostDateTime} {} {LastPostIndex}
Adds a new local secondary index definition to the supplied TableSchema object before writing the TableSchema object back to the pipeline. The TableSchema object can also be supplied using the -Schema parameter.

Supported Version

AWS Tools for PowerShell: 2.x.y.z