Databases Reference
In-Depth Information
3.
Finally, copy the Amazon module to the
sitelib
as follows:
sudo scp -r
AmazonSimpleDB-*-perl-library/src/Amazon $sitelib
After the AWS Perl module is installed, get the
amazon-simpledb-cli
script like so:
sudo curl -Lo /usr/local/bin/simpledb http://simpledb-cli.notlong.com
and set the script permissions to allow everyone to execute the script as follows:
sudo chmod +x /usr/local/bin/simpledb
The program is now all ready to be used. Next, make sure to locate the AWS credentials — the AWS
access key and the AWS access secret key, which are available from your account page — and have
them handy to test the
amazon-simpledb-cli
script (installed as
simpledb
in the
/usr/local/bin
folder
) you just installed.
To use the
simpledb
script you need to pass in the access key and the secret access key to the
aws-
access-key-id
and
aws-secret-access-key
command-line arguments, respectively. Alternatively,
you can set default access key and secret access key values using the
$AWS_ACCESS_KEY_ID
and
$AWS_SECRET_ACCESS_KEY
environment variables.
You can create a domain as follows:
simpledb create-domain domain1
You can add items to this domain as follows:
simpledb put domain1 item1 key1=valueA key2=value2 anotherKey=someValue
simpledb put domain1 item2 key1=valueB key2=value2 differentKey=aValue
Then you can edit
item1
and add another attribute-value pair to it as follows:
simpledb put domain1 item1 yetAnotherKey=anotherValue
You can replace an attribute-value pair with a newer one as follows:
simpledb put-replace domain1 item1 key1=value1 newKey1=newValue1
You can delete an attribute or just the value of an attribute. Examples could be:
simpledb delete mydomain item1 anotherKey
simpledb delete mydomain item2 key2=value2
At the account level you can list all domains like so:
simpledb list-domains
You can list all item names in a domain like so:
simpledb select 'select itemName() from domain1'