DynamoDB Cookbook: Over 90 hands-on recipes to design Internet scalable web and mobile applications with Amazon DynamoDB
()
About this ebook
Tanmay Deshpande
Tanmay Deshpande is a Hadoop and big data evangelist. He currently works with Schlumberger as a Big Data Architect in Pune, India. He has interest in a wide range of technologies, such as Hadoop, Hive, Pig, NoSQL databases, Mahout, Sqoop, Java, cloud computing, and so on. He has vast experience in application development in various domains, such as oil and gas, finance, telecom, manufacturing, security, and retail. He enjoys solving machine-learning problems and spends his time reading anything that he can get his hands on. He has great interest in open source technologies and has been promoting them through his talks. Before Schlumberger, he worked with Symantec, Lumiata, and Infosys. Through his innovative thinking and dynamic leadership, he has successfully completed various projects. He regularly blogs on his website http://hadooptutorials.co.in. You can connect with him on LinkedIn at https://www.linkedin.com/in/deshpandetanmay/. He has also authored Mastering DynamoDB, published in August 2014, DynamoDB Cookbook, published in September 2015, Hadoop Real World Solutions Cookbook-Second Edition, published in March 2016, Hadoop: Data Processing and Modelling, published in August, 2016, and Hadoop Blueprints, published in September 2016, all by Packt Publishing.
Read more from Tanmay Deshpande
Mastering DynamoDB Rating: 0 out of 5 stars0 ratingsHadoop Blueprints Rating: 0 out of 5 stars0 ratings
Related to DynamoDB Cookbook
Related ebooks
DynamoDB Applied Design Patterns Rating: 3 out of 5 stars3/5Google Cloud Platform an Architect's Guide Rating: 5 out of 5 stars5/5Apache Hive Cookbook Rating: 0 out of 5 stars0 ratingsMongoDB Cookbook - Second Edition: Modern Database Management Made Easy Rating: 0 out of 5 stars0 ratingsApache Spark for Data Science Cookbook Rating: 0 out of 5 stars0 ratingsHadoop Essentials Rating: 5 out of 5 stars5/5ElasticSearch Cookbook Rating: 5 out of 5 stars5/5Learning Elasticsearch Rating: 4 out of 5 stars4/5Mastering Apache Cassandra - Second Edition Rating: 0 out of 5 stars0 ratingsPostgreSQL for Data Architects Rating: 3 out of 5 stars3/5Databases DeMYSTiFieD, 2nd Edition Rating: 3 out of 5 stars3/5Apache Hive Essentials Rating: 0 out of 5 stars0 ratingsInstant MongoDB Rating: 0 out of 5 stars0 ratingsBig data Hadoop Interview Guide Rating: 0 out of 5 stars0 ratingsLearn MongoDB in 24 Hours Rating: 5 out of 5 stars5/5Mastering PostgreSQL: A Comprehensive Guide for Developers Rating: 0 out of 5 stars0 ratingsAWS Certified Database Study Guide: Specialty (DBS-C01) Exam Rating: 0 out of 5 stars0 ratingsNoSQL Essentials: Navigating the World of Non-Relational Databases Rating: 0 out of 5 stars0 ratingsAmazon Web Services for Mobile Developers: Building Apps with AWS Rating: 0 out of 5 stars0 ratingsMicroservices Deployment Cookbook Rating: 0 out of 5 stars0 ratingsStep by Step: Fault-tolerant, Scalable, Secure AWS Web Stack Rating: 0 out of 5 stars0 ratingsASP.NET Application Development Fundamentals Rating: 0 out of 5 stars0 ratingsDevOps. How to build pipelines with Jenkins, Docker container, AWS ECS, JDK 11, git and maven 3? Rating: 0 out of 5 stars0 ratingsAmazon S3 Cookbook Rating: 0 out of 5 stars0 ratings
Internet & Web For You
Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 4 out of 5 stars4/5Cybersecurity For Dummies Rating: 5 out of 5 stars5/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Coding For Dummies Rating: 5 out of 5 stars5/5How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5UX/UI Design Playbook Rating: 4 out of 5 stars4/5More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5Get Into UX: A foolproof guide to getting your first user experience job Rating: 4 out of 5 stars4/5Principles of Web Design Rating: 0 out of 5 stars0 ratingsThe Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5The Basics of User Experience Design by Interaction Design Foundation Rating: 4 out of 5 stars4/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/548 Really Useful Web Sites Rating: 5 out of 5 stars5/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsCanva Tips and Tricks Beyond The Limits Rating: 3 out of 5 stars3/5The Gothic Novel Collection Rating: 5 out of 5 stars5/52022 Adobe® Premiere Pro Guide For Filmmakers and YouTubers Rating: 5 out of 5 stars5/5Sell Online Like a Creative Genius: A Guide for Artists, Entrepreneurs, Inventors, and Kindred Spirits Rating: 5 out of 5 stars5/5Build a WordPress Website From Scratch 2024: WordPress 2024 Rating: 0 out of 5 stars0 ratingsThe Designer’s Guide to Figma: Master Prototyping, Collaboration, Handoff, and Workflow Rating: 3 out of 5 stars3/5
Reviews for DynamoDB Cookbook
0 ratings0 reviews
Book preview
DynamoDB Cookbook - Tanmay Deshpande
Table of Contents
DynamoDB Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Taking Your First Steps with DynamoDB
Introduction
Signing up to the DynamoDB console
Getting ready
How to do it…
How it works…
There's more…
Creating the DynamoDB table using the console
Getting ready
How to do it…
How it works…
There's more…
Loading data into the table using the console
Getting ready
How to do it…
How it works…
Querying data using the DynamoDB console
Getting ready
How to do it…
How it works…
Deleting the DynamoDB table using the console
Getting ready
How to do it…
How it works…
Analyzing DynamoDB metric on CloudWatch
Getting ready
How to do it…
How it works…
There's more…
Downloading and setting up DynamoDB Local
Getting ready
How to do it…
How it works…
There's more…
Using DynamoDB Local JavaScript Shell
Getting ready
How to do it…
How it works…
Setting up AWS Command Line Interface for DynamoDB
Getting ready
How to do it…
How it works…
There's more…
Setting up the Eclipse IDE
Getting ready
How to do it…
How it works…
2. Operating with DynamoDB Tables
Introduction
Creating a table using the AWS SDK for Java
Getting ready
How to do it…
How it works…
There's more…
Creating a table using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Creating a table using the AWS SDK for PHP
Getting ready…
How to do it…
How it works…
Updating a table using the AWS SDK for Java
Getting ready…
How to do it…
How it works…
Updating a table using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Updating a table using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Listing tables using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Listing tables using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Listing tables using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Deleting a table using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Deleting a table using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Deleting a table using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
3. Manipulating DynamoDB Items
Introduction
Putting an item into the DynamoDB table using the AWS SDK for Java
Getting ready
How to do it…
How it works…
There's more…
Putting an item into the DynamoDB table using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Putting an item into the DynamoDB table using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Getting an item from the DynamoDB table using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Getting an item from the DynamoDB table using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Getting an item from the DynamoDB table using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Updating an item in the DynamoDB table using the AWS SDK for Java
Getting ready
How to do it…
How it works…
There's more…
Updating an item in the DynamoDB table using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
There's more…
Updating an item in the DynamoDB table using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
There's more…
Deleting an item from the DynamoDB table using the AWS SDK for Java
Getting ready
How to do it…
How it works…
There's more…
Deleting an item from the DynamoDB table using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
There's more…
Deleting an item from the DynamoDB table using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
There's more…
Getting multiple items using the AWS SDK for Java
Getting ready
How to do it
How it works…
Getting multiple items using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Getting multiple items using the AWS SDK for PHP
Getting ready…
How to do it…
How it works…
Batch write operations using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Batch write operations using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Batch write operations using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
4. Managing DynamoDB Indexes
Introduction
Creating a DynamoDB table with a Global Secondary Index using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Creating a DynamoDB table with a Global Secondary Index using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Creating a DynamoDB table with a Global Secondary Index using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Querying a Global Secondary Index using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Querying a Global Secondary Index using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Querying a Global Secondary Index using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Creating a DynamoDB table with a Local Secondary Index using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Creating a DynamoDB table with a Local Secondary Index using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Creating a DynamoDB table with a Local Secondary Index using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Querying a Local Secondary Index using the AWS SDK for Java
Getting ready
How to do it…
How it works…
Querying a Local Secondary Index using the AWS SDK for .Net
Getting ready
How to do it…
How it works…
Querying a Local Secondary Index using the AWS SDK for PHP
Getting ready
How to do it…
How it works…
Using a Global Secondary Index for quick lookups
Getting ready
How to do it…
How it works…
5. Exploring Higher Level Programming Interfaces for DynamoDB
Introduction
Creating a data model for the DynamoDB item using the object persistence model in Java
Getting ready
How to do it…
How it works…
Putting items into the DynamoDB table using the object persistence model in Java
Getting ready
How to do it…
How it works…
Retrieving items from the DynamoDB table using the object persistence model in Java
Getting ready
How to do it…
How it works…
Creating a custom object for the DynamoDB table using the object persistence model in Java
Getting ready
How to do it…
How it works…
Querying items from the DynamoDB table using the object persistence model in Java
Getting ready
How to do it…
How it works…
Scanning items from the DynamoDB table using the object persistence model in Java
Getting ready
How to do it…
How it works…
There's more…
Saving items into the DynamoDB table using the object persistence model in .Net
Getting ready
How to do it…
How it works…
There is more…
Retrieving items from the DynamoDB table using the object persistence model in .Net
Getting ready
How to do it…
How it works…
There is more…
Creating a custom object for the DynamoDB table using the object persistence model in .Net
Getting ready
How to do it…
How it works…
Querying items from the DynamoDB table using the object persistence model in .Net
Getting ready
How to do it…
How it works…
Scanning items from the DynamoDB table using the object persistence model in .Net
Getting ready
How to do it…
How it works…
6. Securing DynamoDB
Introduction
Creating users using AWS IAM
Getting ready
How to do it…
How it works…
Creating a DynamoDB full access group using AWS IAM
Getting ready
How to do it…
How it works…
Creating a DynamoDB read-only group using AWS IAM
Getting ready
How to do it…
How it works…
Validating the DynamoDB access controls using the AWS IAM policy simulator
Getting ready
How to do it…
How it works…
Creating the custom policy to allow the DynamoDB console access using AWS IAM
Getting ready
How to do it…
How it works…
Creating a fine-grained access control policy using AWS IAM
Getting ready
How to do it…
How it works…
Implementing the client-side encryption for the DynamoDB data
Getting ready
How to do it…
How it works…
Implementing the client-side masking for the DynamoDB data
Getting ready
How to do it…
How it works…
7. DynamoDB Best Practices
Introduction
Using a standalone cache for frequently accessed items
Getting ready
How to do it…
How it works…
Using the AWS ElastiCache for frequently accessed items
Getting ready
How to do it…
How it works…
Compressing large data before storing it in DynamoDB
Getting ready
How to do it…
How it works…
Using AWS S3 for storing large items
Getting ready
How to do it…
How it works…
Catching DynamoDB errors
Getting ready
How to do it…
How it works…
Performing auto-retries on DynamoDB errors
Getting ready
How to do it…
How it works…
Performing atomic transactions on DynamoDB tables
Getting ready
How to do it…
How it works…
Performing asynchronous requests to DynamoDB
Getting ready
How to do it…
How it works
8. Integrating DynamoDB with other AWS Services
Introduction
Importing data from AWS S3 to DynamoDB using AWS Data Pipeline
Getting ready
How to do it…
How it works…
Exporting data from AWS S3 to DynamoDB using AWS Data Pipeline
Getting ready
How to do it…
How it works…
Accessing the DynamoDB data using AWS EMR
Getting ready
How to do it…
How it works…
Querying the DynamoDB data using AWS EMR
Getting ready
How to do it…
How it works…
Performing join operations on the DynamoDB data using AWS EMR
Getting ready
How to do it…
How it works…
Exporting data to AWS S3 from DynamoDB using AWS EMR
Getting ready
How to do it…
How it works…
Logging DynamoDB operations using AWS CloudTrail
Getting ready
How to do it…
How it works…
Exporting the DynamoDB data to AWS Redshift
Getting ready
How to do it…
How it works…
Importing the DynamoDB data to AWS CloudSearch
Getting ready
How to do it…
How it works…
Performing a full text search on the DynamoDB data using CloudSearch
Getting ready
How to do it…
How it works…
9. Developing Web Applications using DynamoDB
Introduction
Performing data modeling and table creations
Getting ready
How to do it…
How it works…
Developing services for the sign-up activity for web applications
Getting ready
How to do it…
How it works…
Developing services for the sign-in activity for web applications
Getting ready
How to do it…
How it works…
Developing services for the Address Book application
Getting ready
How to do it…
How it works…
Deploying web applications on AWS Elastic Beanstalk
Getting ready
How to do it…
How it works…
10. Developing Mobile Applications using DynamoDB
Introduction
Performing data modeling and table creation
Getting ready
How to do it…
How it works…
Creating an identity pool using AWS Cognito
Getting ready
How to do it…
How it works…
Creating the access policy and applying it to the AWS Cognito role
Getting ready
How to do it…
How it works…
Implementing user registration services
Getting ready…
How to do it…
How it works…
Implementing user login services
Getting ready…
How to do it…
How it works…
Implementing add new contact services
Getting ready…
How to do it…
How it works…
Implementing view contacts services
Getting ready…
How to do it…
How it works…
Index
DynamoDB Cookbook
DynamoDB Cookbook
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form, or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing, and its dealers and distributors, will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2015
Production reference: 1210915
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-375-5
www.packtpub.com
Credits
Author
Tanmay Deshpande
Reviewers
Sergio Alcantara
Kenny Ha
Volker Kueffel
Dr. Jun-young Kwak
Commissioning Editor
Pramila Balan
Acquisition Editor
Shaon Basu
Content Development Editor
Divij Kotian
Technical Editor
Naveenkumar Jain
Copy Editor
Rashmi Sawant
Project Coordinator
Neha Bhatnagar
Proofreader
Safis Editing
Indexer
Hemangini Bari
Production Coordinator
Komal Ramchandani
Cover Work
Komal Ramchandani
About the Author
Tanmay Deshpande is a Hadoop and big data evangelist. He currently works with Symantec Corporation as a senior software engineer in Pune, India. He has interests in a wide range of technologies, such as Hadoop, Hive, Pig, NoSQL databases, Mahout, Sqoop, Java, cloud computing, and so on. He has vast experience in application development in various domains, such as finance, telecom, manufacturing, security, and retail. He enjoys solving machine learning problems and likes to spend his time reading anything that he can get his hands on. He has a great interest in open source technologies and has been promoting them through his talks. He has been invited to various colleges to conduct brainstorming sessions with students on the latest technologies.
Before Symantec Corporation, he worked with Infosys, where he worked as the lead Big Data/Cloud developer. He was a core team member of the Infosys Big Data Edge platform. Through his innovative thinking and dynamic leadership, he successfully completed various projects.
Before he wrote this book, he also authored two books, Mastering DynamoDB and Cloud Computing. He regularly blogs at http://hadooptutorials.co.in
Acknowledgments
This is the third book in a row for me, and I can't stop myself from imagining this to be real without my grandparents' love and care. I know that they are there somewhere and constantly blessing me with their best wishes all the time. I would like to dedicate this book to my grandparents, Late Mrs. Usha and Late Mr. Bhaskar Deshpande, Mrs. Malati and Late Mr. Madhukar Budukh.
I would like to thank my wife, Sneha, for standing beside me through thick and thin. She has been the source of inspiration and motivation to achieve bigger and better in life. I appreciate her patience to allow me to dedicate more time for this book and understanding what it means to me, without any complaints.
I would like to thank my mom, Mrs. Manisha Deshpande, my dad, Mr. Avinash Deshpande, and my brother, Sakalya, for encouraging me to follow my ambitions and for making me what I am today.
Above all, I would like thank the Almighty for giving me power to believe in my passion and pursue my dreams. This would not have been possible without the faith I have in him!
About the Reviewers
Sergio Alcantara has been building cloud-based platforms since the beginning of Amazon Web Services. Over the years, he has built the backend infrastructure for mobile and web applications that empowered GPS data, big data, and sports gaming. He has taken advantage of cloud computing to build highly reliable and scalable platforms.
Among his latest projects, there are several that use DynamoDB in different ways, but two of them use DynamoDB as their main and only database.