Using PowerShell for common AWS SimpleDB operations

#Create SimpleDB client

Add-Type -Path "C:\AWS SDK\\bin\AWSSDK.dll"
$sdb=[Amazon.AWSClientFactory]::CreateAmazonSimpleDBClient('Key Id', 'Secret Key')

#Create Domain

$req = (new-object Amazon.SimpleDB.Model.CreateDomainRequest).WithDomainName('Contacts')

#List Domains

$req = (new-object Amazon.SimpleDB.Model.ListDomainsRequest)

#Insert Item

$req = (new-object Amazon.SimpleDB.Model.PutAttributesRequest).WithDomainName('Contacts').WithItemName('user1');
$req.Attribute.Add((new-object Amazon.SimpleDB.Model.ReplaceableAttribute).WithName('FirstName').WithValue('Konstantin'))
$req.Attribute.Add((new-object Amazon.SimpleDB.Model.ReplaceableAttribute).WithName('LastName').WithValue('Vlasenko'))

#Query All Items

$req = (new-object Amazon.SimpleDB.Model.SelectRequest).WithSelectExpression('select * from Contacts')

#Query Item

$req = (new-object Amazon.SimpleDB.Model.SelectRequest).WithSelectExpression('select * from Contacts where itemName()="user1"')

One thought on “Using PowerShell for common AWS SimpleDB operations

  1. I follow the code up to the query section. Does this work for anyone else? I’m on Windows 8, PS 3.0 AWS SDK 1.1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: