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

Converts a dictionary of types commonly used in PowerShell to a dictionary of DynamoDB attribute values.

Syntax

ConvertTo-DDBItem
-InputObject <IDictionary[]>

Description

Converts a dictionary of types commonly used in PowerShell to a dictionary of DynamoDB attribute values.

Parameters

-InputObject <IDictionary[]>
A dictionary of commonly used PowerShell types to convert to a dictionary of DynamoDB attribute values. The following types will be converted to the following DynamoDB attribute values:
  • String will be converted to S
  • Boolean will be converted to BOOL
  • Any numeric type will be converted to N
  • MemoryStream will be converted to B
  • Hashtable will be converted to M
  • HashSet<String> will be converted to SS
  • Any numeric HashSet will be converted to NS
  • HashSet<MemoryStream> will be converted to BS
  • Array will be converted to L
  • ArrayList will be converted to L
  • A generic list of any supported type above will be converted to L
Required?False
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)

Outputs

System.Collections.HashTable
This cmdlet returns a dictionary of common types.

Examples

Example 1

@{
SongTitle = 'Somewhere Down The Road'
Artist = 'No One You Know'
} | ConvertTo-DDBItem

Key Value
--- -----
SongTitle Amazon.DynamoDBv2.Model.AttributeValue
Artist Amazon.DynamoDBv2.Model.AttributeValue
An example for converting a hashtable into a dictionary of DynamoDB attribute values.

Example 2

@{
MyMap = @{
MyString = 'my string'
}
MyStringSet = [System.Collections.Generic.HashSet[String]]@('my', 'string')
MyNumericSet = [System.Collections.Generic.HashSet[Int]]@(1, 2, 3)
MyBinarySet = [System.Collections.Generic.HashSet[System.IO.MemoryStream]]@(
([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes('my'))),
([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes('string')))
)
MyList1 = @('my', 'string')
MyList2 = [System.Collections.Generic.List[Int]]@(1, 2)
MyList3 = [System.Collections.ArrayList]@('one', 2, $true)
} | ConvertTo-DDBItem

Key Value
--- -----
MyStringSet Amazon.DynamoDBv2.Model.AttributeValue
MyList1 Amazon.DynamoDBv2.Model.AttributeValue
MyNumericSet Amazon.DynamoDBv2.Model.AttributeValue
MyList2 Amazon.DynamoDBv2.Model.AttributeValue
MyBinarySet Amazon.DynamoDBv2.Model.AttributeValue
MyMap Amazon.DynamoDBv2.Model.AttributeValue
MyList3 Amazon.DynamoDBv2.Model.AttributeValue
An example for converting a hashtable into a dictionary of DynamoDB attribute values.

Supported Version

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