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 KeySchemaElement instance to the supplied TableSchema object.

Syntax

Add-DDBKeySchema
-KeyName <String>
-KeyType <KeyType>
-KeyDataType <ScalarAttributeType>
-Schema <TableSchema>

Description

Adds a new Amazon DynamoDB KeySchemaElement instance to the supplied TableSchema object.

Parameters

-KeyDataType <ScalarAttributeType>
The data type of the key as specified by the Amazon DynamoDB api. If an attribute entry for the key already exists in the attribute definitions of the supplied schema object, this parameter can be omitted otherwise an attribute will be added and defined as the declared type.Valid values for data type: "S" string, "N" number or "B" binary.
Required?False
Position?3
Accept pipeline input?True (ByPropertyName)
-KeyName <String>
The name of the key to be applied to the schema. If a key with the specified name already exists an error is thrown.
Required?True
Position?1
Accept pipeline input?True (ByPropertyName)
-KeyType <KeyType>
The key type. Valid values are "HASH" or "RANGE". If not specified, "HASH" is assumed.
Required?False
Position?2
Accept pipeline input?True (ByPropertyName)
-Schema <TableSchema>
A previously constructed object to which the new key schema element will be added to any attached KeySchema property collection.
Required?True
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)

Outputs

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

Examples

Example 1

$schema = New-DDBTableSchema
$schema | Add-DDBKeySchema -KeyName "ForumName" -KeyDataType "S"

AttributeSchema KeySchema LocalSecondaryIndexSchema
--------------- --------- -------------------------
{ForumName} {ForumName} {}
Creates an empty TableSchema object and adds key and attribute definition entries to it using the specified key data before writing the TableSchema object to the pipeline. The key type is declared to be 'HASH' by default; use the -KeyType paameter with a value of 'RANGE' to declare a range key.

Example 2

New-DDBTableSchema | Add-DDBKeySchema -KeyName "ForumName" -KeyDataType "S"

AttributeSchema KeySchema LocalSecondaryIndexSchema
--------------- --------- -------------------------
{ForumName} {ForumName} {}
Adds new key and attribute definition entries to the supplied TableSchema object before writing the TableSchema object to the pipeline. The key type is declared to be 'HASH' by default; use the -KeyType paameter with a value of 'RANGE' to declare a range key. The TableSchema object can also be supplied using the -Schema parameter.

Supported Version

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