Home > Store

Developer's Guide to Amazon SimpleDB, A

Register your product to gain access to bonus material or receive a coupon.

Developer's Guide to Amazon SimpleDB, A

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2011
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-62363-0
  • ISBN-13: 978-0-321-62363-8

The Complete Guide to Building Cloud Computing Solutions with Amazon SimpleDB

Using SimpleDB, any organization can leverage Amazon Web Services (AWS), Amazon’s powerful cloud-based computing platform–and dramatically reduce the cost and resources associated with application infrastructure. Now, for the first time, there’s a complete developer’s guide to building production solutions with Amazon SimpleDB.

Pioneering SimpleDB developer Mocky Habeeb brings together all the hard-to-find information you need to succeed. Mocky tours the SimpleDB platform and APIs, explains their essential characteristics and tradeoffs, and helps you determine whether your applications are appropriate for SimpleDB. Next, he walks you through all aspects of writing, deploying, querying, optimizing, and securing Amazon SimpleDB applications–from the basics through advanced techniques.

Throughout, Mocky draws on his unsurpassed experience supporting developers on SimpleDB’s official Web forums. He offers practical tips and answers that can’t be found anywhere else, and presents extensive working sample code–from snippets to complete applications.

With A Developer’s Guide to Amazon SimpleDB you will be able to

  • Evaluate whether a project is suited for Amazon SimpleDB
  • Write SimpleDB applications that take full advantage of SimpleDB’s availability, scalability, and flexibility
  • Effectively manage the entire SimpleDB application lifecycle
  • Deploy cloud computing applications faster and more easily
  • Work with SELECT and bulk data operations
  • Fine tune queries to optimize performance
  • Integrate SimpleDB security into existing organizational security plans
  • Write and enhance runtime SimpleDB clients
  • Build complete applications using AJAX and SimpleDB
  • Understand low-level issues involved in writing clients and frameworks
  • Solve common SimpleDB usage problems and avoid hidden pitfalls

This book will be an indispensable resource for every IT professional evaluating or using SimpleDB to build cloud-computing applications, clients, or frameworks.

Downloads

Source Code

Download the source code

Sample Content

Online Sample Chapter

Introducing Amazon SimpleDB

Sample Pages

Download the sample pages (includes Chapter 1 and Index)

Table of Contents

Preface    xvi

Acknowledgments    xviii

1    Introducing Amazon SimpleDB    1

What Is SimpleDB?    1

What SimpleDB Is Not    1

Schema-Less Data    2

Stored Securely in the Cloud    2

Billed Only for Actual Usage    3

Domains, Items, and Attribute Pairs    3

Multi-Valued Attributes    3

Queries    4

High Availability    4

Database Consistency    5

Sizing Up the SimpleDB Feature Set    6

Benefits of Using SimpleDB    6

Database Features SimpleDB Doesn’t Have    7

Higher-Level Framework Functionality    7

Service Limits    8

Abandoning the Relational Model?    8

A Database Without a Schema    9

Areas Where Relational Databases Struggle    10

Scalability Isn’t Your Problem    11

Avoiding the SimpleDB Hype    11

Putting the DBA Out of Work    12

Dodging Copies of C.J. Date    13

Other Pieces of the Puzzle    14

Adding Compute Power with Amazon EC2    14

Storing Large Objects with Amazon S3    14

Queuing Up Tasks with Amazon SQS    15

Comparing SimpleDB to Other Products and Services    15

Windows Azure Platform    15

Google App Engine    17

Apache CouchDB    17

Dynamo-Like Products    18

Compelling Use Cases for SimpleDB    18

Web Services for Connected Systems    18

Low-Usage Application    19

Clustered Databases Without the Time Sink    19

Dynamic Data Application    19

Amazon S3 Content Search    20

Empowering the Power Users    20

Existing AWS Customers    20

Summary    21

2    Getting Started with SimpleDB    23

Gaining Access to SimpleDB    23

Creating an AWS Account    23

Signing Up for SimpleDB    24

Managing Account Keys    24

Finding a Client for SimpleDB    24

Building a SimpleDB Domain Administration Tool    25

Administration Tool Features    25

Key Storage    25

Implementing the Base Application    26

Displaying a Domain List    28

Adding Domain Creation    28

Supporting Domain Deletion    29

Listing Domain Metadata    29

Running the Tool    31

Packaging the Tool as a Jar File    31

Building a User Authentication Service    31

Integrating with the Spring Security Framework    32

Representing User Data    32

Fetching User Data with SimpleDBUserService    34

Salting and Encoding Passwords    36

Creating a User Update Tool    37

Summary    39

3    A Code-Snippet Tour of the SimpleDB API    41

Selecting a SimpleDB Client    41

Typica Setup in Java    42

C# Library for Amazon SimpleDB Setup    43

Tarzan Setup in PHP    45

Common Concepts    45

The Language Gap    45

SimpleDB Endpoints    45

SimpleDB Service Versions    47

Common Response Elements    47

CreateDomain    48

CreateDomain Parameters    49

CreateDomain Response Data    49

CreateDomain Snippet in Java    49

CreateDomain Snippet in C#    50

CreateDomain Snippet in PHP    50

ListDomains    51

ListDomains Parameters    51

ListDomains Response Data    51

ListDomains Snippet in Java    52

ListDomains Snippet in C#    52

ListDomains Snippet in PHP    53

DeleteDomain    54

DeleteDomain Parameters    54

DeleteDomain Response Data    54

DeleteDomain Snippet in Java    55

DeleteDomain Snippet in C#    55

DeleteDomain Snippet in PHP    55

DomainMetadata    56

DomainMetadata Parameters    56

DomainMetadata Response Data    56

DomainMetadata Snippet in Java    57

DomainMetadata Snippet in C#    58

DomainMetadata Snippet in PHP    58

PutAttributes    59

PutAttributes Parameters    60

PutAttributes Response Data    62

PutAttributes Snippet in Java    63

PutAttributes Snippet in C#    64

PutAttributes Snippet in PHP    65

GetAttributes    65

GetAttributes Parameters    65

GetAttributes Response Data    66

GetAttributes Snippet in Java    67

GetAttributes Snippet in C#    68

GetAttributes Snippet in PHP    69

DeleteAttributes    70

DeleteAttributes Parameters    70

DeleteAttributes Response Data    71

DeleteAttributes Snippet in Java    72

DeleteAttributes Snippet in C#    72

DeleteAttributes Snippet in PHP    73

BatchPutAttributes    73

BatchPutAttributes Parameters    74

BatchPutAttributes Response Data    75

BatchPutAttributes Snippet in Java    76

BatchPutAttributes Snippet in C#    77

BatchPutAttributes Snippet in PHP    78

Select    79

Select Parameters    79

Select Response Data    80

Select Snippet in Java    81

Select Snippet in C#    83

Select Snippet in PHP    85

Summary    86

4    A Closer Look at Select    87

Select Syntax    87

Required Clauses    88

Select Quoting Rule for Names    88

Output Selection Clause    89

WHERE Clause    90

Select Quoting Rules for Values    90

Sort Clause    91

LIMIT Clause    92

Formatting Attribute Data for Select    93

Integer Formatting    94

Floating Point Formatting    95

Date and Time Formatting    95

Case Sensitivity    97

Expressions and Predicates    97

Simple Comparison Operators    98

Range Operators    98

IN() Queries    99

Prefix Queries with LIKE and NOT LIKE    99

IS NULL and IS NOT NULL    100

Multi-Valued Attribute Queries    100

Multiple Predicate Queries with the INTERSECTION

Operator    101

Selection with EVERY()    102

Query Results with the Same Item Multiple Times    102

Improving Query Performance    103

Attribute Indexes    103

Composite Attributes    104

Judicious Use of LIKE    105

Running on EC2    106

Skipping Pages with count() and LIMIT    106

Measuring Select Performance    107

Automating Performance Measurements    109

Summary    110

5    Bulk Data Operations    111

Importing Data with BatchPutAttributes    112

Calling BatchPutAttributes    112

Mapping the Import File to SimpleDB Attributes    112

Supporting Multiple File Formats    113

Storing the Mapping Data    113

Reporting Import Progress    113

Creating Right-Sized Batches    114

Managing Concurrency    114

Resuming a Stopped Import    115

Verifying Progress and Completion    115

Properly Handling Character Encodings    116

Backup and Data Export    116

Using Third-Party Backup Services    117

Writing Your Own Backup Tool    118

Restoring from Backup    119

Summary    119

6    Working Beyond the Boundaries    121

Availability: The Final Frontier    121

Boundaries of Eventual Consistency    123

Item-Level Atomicity    123

Looking into the Eventual Consistency Window    124

Read-Your-Writes    125

Implementing a Consistent View    125

Handling Text Larger Than    1K    128

Storing Text in S3    128

Storing Overflow in Different Attributes    129

Storing Overflow as a Multi-Valued Attribute    130

Entities with More than    256 Attributes    131

Paging to Arbitrary Query Depth    131

Exact Counting Without Locks or Transactions    133

Using One Item Per Count    134

Storing the Count in a Multi-Valued Attribute    136

Testing Strategies    138

Designing for Testability    138

Alternatives to Live Service Calls    139

Summary    139

7    Planning for the Application Lifecycle    141

Capacity Planning    141

Estimating Initial Costs    141

Keeping Tabs on SimpleDB Usage with AWS Usage

Reports    142

Creating More Finely Detailed Usage Reports    145

Tracking Usage over Time    146

Storage Requirements    146

Computing Storage Costs    147

Understanding the Cost of Slack Space    147

Evaluating Attribute Concatenation    148

Scalability: Increasing the Load    148

Planning Maintenance    150

Using Read-Repair to Apply Formatting Changes    150

Using Read-Repair to Update Item Layout    152

Using a Batch Process to Apply Updates    152

Summary    153

8    Security in SimpleDB-Based Applications    155

Account Security    155

Managing Access Within the Organization    155

Limiting Amazon Access from AWS Credentials    157

Boosting Security with Multi-Factor Authentication    158

Access Key Security    159

Key Management    159

Secret Key Rotation    160

Data Security    161

Storing Clean Data    161

SSL and Data in Transmission    162

Data Storage and Encryption    164

Storing Data in Multiple Locations    165

Summary    165

9    Increasing Performance    167

Determining If SimpleDB Is Fast Enough    167

Targeting Moderate Performance in Small Projects    167

Exploiting Advanced Features in Small Projects    168

Speeding Up SimpleDB    169

Taking Detailed Performance Measurements    169

Accessing SimpleDB from EC2    169

Caching    170

Concurrency    172

Keeping Requests and Responses Small    173

Operation-Specific Performance    174

Optimizing GetAttributes    174

Optimizing PutAttributes    178

Optimizing BatchPutAttributes    179

Optimizing Select    180

Data Sharding    181

Partitioning Data    181

Multiplexing Queries    181

Accessing SimpleDB Outside the Amazon Cloud    182

Working Around Latency    182

Ignoring Latency    183

Summary    183

10    Writing a SimpleDB Client: A Language-Independent

Guide    185

Client Design Overview    185

Public Interface    186

Attribute Class    188

Item Class    190

Client Design Considerations    191

High-Level Design Issues    191

Operation-Specific Considerations    193

Implementing the Client Code    196

Safe Handling of the Secret Key    196

Implementing the Constructor    197

Implementing the Remaining Methods    198

Making Requests    200

Computing the Signature    208

Making the Connections    210

Parsing the Response    214

Summary    216

11    Improving the SimpleDB Client    217

Convenience Methods    217

Convenient Count Methods    217

Select with a Real Limit    219

Custom Metadata and Building a Smarter Client    219

Justifying a Schema for Numeric Data    220

Database Tools    221

Coordinating Concurrent Clients    221

Storing Custom Metadata within SimpleDB    221

Storing Custom Metadata in S3    222

Automatically Optimizing for Box Usage Cost    222

The Exponential Cost of Write Operations    223

QueryTimeout: The Most Expensive Way to Get Nothing    225

Automated Domain Sharding    228

Domain Sharding Overview    228

Put/Get Delete Routing    228

Query Multiplexing    231

Summary    232

12    Building a Web-Based Task List    233

Application Overview    233

Requirements    233

The Data Model    234

Implementing User Authentication    235

Implementing a Task Workspace    238

Implementing a Task Service    241

Adding the Login Servlet    244

Adding the Logout Servlet    249

Displaying the Tasks    249

Adding New Tasks    252

Deployment    252

Summary    254

Index    255

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020