On the use, this is a heloworld tutorial, first we create a domain domains, equivalent to a table.
Note that we can not do the connection between the domain operation, a single query can only be for a domain, not cross-domain, this is a limitation of simpledb, so developers should plan, do not choose the wrong domain. In addition, all of the storage is STRING,UTF-8 encoded.
You can use the Java,python,ruby development package, here is not much to say, here only to enumerate HTTP requests and responses, in the rest of the example.
1 Create a domain first
https://sdb.amazonaws.com/
? Action=createdomain
&awsaccesskeyid=[valid access key ID]
&domainname=hongchangfirst
&signatureversion=2
&signaturemethod=hmacsha256
×tamp=2014-01-25t15%3a01%3a28-07%3a00
&version=2009-04-15
&signature=[valid Signature]
Response to
<CreateDomainResponse>
<ResponseMetadata>
<RequestId>2a1305a2-ed1c-43fc-b7c4-e6966b5e2727</RequestId>
<BoxUsage>0.0000219907</BoxUsage>
</ResponseMetadata>
</CreateDomainResponse>
2 plus one data in, replace means instead of adding a value, instead of replacing the value of the response, avoid associating multiple values.
https://sdb.amazonaws.com/
? Action=putattributes
&domainname=hongchangfirst
&itemname=zhc
&attribute.1.name=color
&attribute.1.value=blue
&attribute.2.name=price
&attribute.2.value=0014.99
&attribute.2.replace=true
&awsaccesskeyid=[valid access key ID]
&signatureversion=2
&signaturemethod=hmacsha256
×tamp=2010-01-25t15%3a03%3a05-07%3a00
&version=2009-04-15
&signature=[valid Signature]
The response is:
<PutAttributesResponse>
<ResponseMetadata>
<RequestId>490206ce-8292-456c-a00f-61b335eb202b</RequestId>
<BoxUsage>0.0000219907</BoxUsage>
</ResponseMetadata>
</PutAttributesResponse>
3 to get the data you just added.
https://sdb.amazonaws.com/
? Action=getattributes
&awsaccesskeyid=[valid access key ID]
&domainname=hongchangfirst
&itemname=zhc
&signatureversion=2
&signaturemethod=hmacsha256
×tamp=2010-01-25t15%3a03%3a07-07%3a00
&version=2009-04-15
&signature=[valid Signature]
The response is:
<GetAttributesResponse>
<GetAttributesResult>
<Attribute><Name>Color</Name><Value>Blue</Value></Attribute>
<Attribute><Name>Price</Name><Value>0014.99</Value></Attribute>
</GetAttributesResult>
<ResponseMetadata>
<RequestId>b1e8f1f7-42e9-494c-ad09-2674e557526d</RequestId>
<BoxUsage>0.0000219907</BoxUsage>
</ResponseMetadata>
</GetAttributesResponse>
4 SimpleDB Another feature is that you can use the class SELECT statement to query the value of a related property, and limit limits the item count of one response.
Select Output_list
From domain_name
[Where expression]
[Sort_instructions]
[Limit limit]
To select a property that has only one value, use where every (name) = value.
Original: http://blog.csdn.net/hongchangfirst/article/details/25538133
Author: Hongchangfirst
Hongchangfirst's homepage: http://blog.csdn.net/hongchangfirst