To complete the following sections, you must make configuration changes to the sample files.
To prepare the sample files
Extract the Amazon SimpleDB sample code into a directory on your machine designated as <sdb home>.
Configure your CLASSPATH environment variable to point to the Amazon SimpleDB Samples JAR archive and the included third party JARs. The following is an example in Linux.
export CLASSPATH=$CLASSPATH:\
<sdb home>/amazon-simpledb-2007-11-07-java-library\
/src/com/amazonaws/sdb/samples/\
<sdb home>/lib/amazon-simpledb-2007-11-07-java-library.jar:\
<sdb home>/third-party/jakarta-commons/commons-codec-1.3.jar:\
<sdb home>/third-party/jakarta-commons/commons-httpclient-3.0.1.jar:\
<sdb home>/third-party/jakarta-commons/commons-logging-1.1.jar:\
<sdb home>/third-party/jaxb-ri-2.1/activation.jar:\
<sdb home>/third-party/jaxb-ri-2.1/jaxb-all-deps.jar:\
<sdb home>/third-party/jaxb-ri-2.1/jaxb-api.jar:\
<sdb home>/third-party/jaxb-ri-2.1/jaxb-impl.jar:\
<sdb home>/third-party/jaxb-ri-2.1/jaxb-xjc.jar:\
<sdb home>/third-party/jaxb-ri-2.1/jsr173_1.0_api.jar:\
<sdb home>/third-party/log4j/log4j-1.2.14.jar
The following command changes your working directory.
<sdb home>/amazon-simpledb-2007-11-07-java-library/src/com/amazonaws/sdb/samples/
Open src/com/amazonaws/sdb/samples/CreateDomainSample.java.
Determine whether you will run the code against the mock service or your Amazon SimpleDB account:
To run the code against the mock service, comment out the following lines:
String accessKeyId = "<Your Access Key ID>"; String secretAccessKey = "<Your Secret Access Key>" AmazonSimpleDB service = new AmazonSimpleDBClient(accessKeyId, secretAccessKey)
Then, remove comment marks from the following line:
AmazonSimpleDB service = new AmazonSimpleDBMock();
To run the code against Amazon SimpleDB, make sure the following lines are not commented out and enter your Access Key ID and Secret Access Key:
String accessKeyId = "<Your Access Key ID>"; String secretAccessKey = "<Your Secret Access Key>" AmazonSimpleDB service = new AmazonSimpleDBClient(accessKeyId, secretAccessKey)
Make sure the following line is commented out:
AmazonSimpleDB service = new AmazonSimpleDBMock();
Save the file.
Repeat this procedure for each file in the samples directory.
Note that the C# example performs all actions in one call: creating a domain, listing a domain, putting data into a domain, getting data from a domain, deleting values from an attribute, deleting an attribute, replacing an attribute, deleting an item, and deleting a domain.
To prepare the sample files
Go to the AWS SDK for .NET page and download the AWS .NET SDK.
Run the downloaded installation program,
AWSSDKInstaller.msi.
The installation installs to C:\Program Files\AWS SDK for
.NET by default.
Go to C:\Program Files\AWS SDK for
.NET\samples and unzip the
AmazonSimpleDB_Sample.zip to a directory on your
machine designated as <sdb home>.
Open the following sample solution:
<sdb home>/AmazonSimpleDB_Sample/AmazonSimpleDB_Sample.sln.
Open the App.config file.
Enter your Access Key ID and Secret Access Key:
<add key="AWSAccessKey" value="<Your Access Key ID>"/> <add key="AWSSecretKey" value="<Your Secret Access Key>"/>
Save the file.
To prepare the sample files
Extract the Amazon SimpleDB sample code into a directory on your machine designated as <sdb home>.
Open the src/Amazon/SimpleDB/Samples/CreateDomainSample.pl sample file.
Determine whether you will run the code against the mock service or your Amazon SimpleDB account:
To run the code against the mock service, comment out the following lines:
my $AWS_ACCESS_KEY_ID = "<Your Access Key ID>"; my $AWS_SECRET_ACCESS_KEY = "<Your Secret Access Key>"; use Amazon::SimpleDB::Client; my $service = Amazon::SimpleDB::Client->new($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY);
Then, remove comment marks from the following line:
use Amazon::SimpleDB::Mock; my $service = Amazon::SimpleDB::Mock->new;
To run the code against Amazon SimpleDB, make sure the following lines are not commented out and enter your Access Key ID and Secret Access Key:
my $AWS_ACCESS_KEY_ID = "<Your Access Key ID>"; my $AWS_SECRET_ACCESS_KEY = "<Your Secret Access Key>"; use Amazon::SimpleDB::Client; my $service = Amazon::SimpleDB::Client->new($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY);
Make sure the following lines are commented out:
use Amazon::SimpleDB::Mock; my $service = Amazon::SimpleDB::Mock->new;
Save the file.
Repeat this procedure for each file in the samples directory.
To prepare the sample files
Extract the Amazon SimpleDB sample code into a directory on your machine designated as <sdb home>.
Open a sample file in the
src/Amazon/SimpleDB/Samples/
directory.
Determine whether you will run the code against the mock service or your Amazon SimpleDB account:
To run the code against the mock service, comment out the following lines:
$AWS_ACCESS_KEY_ID = 'Your Access Key ID';
$AWS_SECRET_ACCESS_KEY = 'Your Secret Access Key';
require_once ('Amazon/SimpleDB/Client.php');
$service = new Amazon_SimpleDB_Client($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY;
Then, remove comment marks from the following line:
require_once ('Amazon/SimpleDB/Mock.php');
$service = new Amazon_SimpleDB_Mock();
To run the code against Amazon SimpleDB, make sure the following lines are not commented out and enter your Access Key ID and Secret Access Key:
$AWS_ACCESS_KEY_ID = 'Your Access Key ID';
$AWS_SECRET_ACCESS_KEY = 'Your Secret Access Key';
require_once ('Amazon/SimpleDB/Client.php');
$service = new Amazon_SimpleDB_Client($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY;
Make sure the following lines are commented out:
require_once ('Amazon/SimpleDB/Mock.php');
$service = new Amazon_SimpleDB_Mock();
Save the file.
Repeat this procedure for each file in the samples directory.
The scratchpad is a sample web application that enables you to test and make calls to Amazon SimpleDB without having to set up a programming environment.
To prepare the scratchpad
Copy the scratchpad files to a location on your computer.
Open the index.html file with a web browser. The welcome page appears.
Enter your AWS Access Key ID and your Secret Access Key.
Follow the tutorial described in the remainder of this document.