Reader small image

You're reading from  Mastering DynamoDB

Product typeBook
Published inAug 2014
PublisherPackt
ISBN-139781783551958
Edition1st Edition
Concepts
Right arrow
Author (1)
Tanmay Deshpande
Tanmay Deshpande
author image
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 about Tanmay Deshpande

Right arrow

Chapter 5. Advanced Topics

In the previous chapter, we talked about the best practices one should follow in order to get the most out of DynamoDB. In this chapter, we are going to talk about some advanced topics:

  • Monitoring DynamoDB tables

  • AWS authentication service

  • AWS IAM integration with DynamoDB

  • Security token service

  • Error handling in DynamoDB

We will also talk about limitations of DynamoDB that every developer needs to consider while designing the schema and doing the implementation.

Monitoring DynamoDB tables


To start with, let's get familiar with AWS CloudWatch, which is a network-monitoring service offered by Amazon Web Service. While creating a table, you can set alarms for various events such as provisioning a throughput with exceeded exceptions, maintaining certain threshold, and so on. A table's size in terms of bytes or number of items is not available as a CloudWatch metric by default; however, this can be set up using the DescribeTable operation, and it is a good practice to keep watch on this metric. These metrics are very important from the database admin's point of view, but as we are using a hosted service here, we need not hire a DBA specialist. These metrics would help us keep track of whether there is any sudden demand of resources happening or not, and if the peak and slow time frames can be drawn for our application so that we can keep more read and write throughput for peak time frames and lesser throughput for slow time frames. CloudWatch gives us...

Using IAM to provide access control to DynamoDB


Some of you might be aware of the concept called access control on resources. This is a very familiar concept in relational databases where we can have multiple users accessing the same database but different roles. This is very crucial from the application's security point of view. A user should have privileges and access to only the required resources in order to avoid misuse. In order to implement the concept on Cloud, AWS supports Identity and Access Management (IAM) as a service. This service allows us to perform the following:

  • Create multiple AWS accounts that access the same resources with different privileges

  • Create group users with similar privileges for the same level of accesses

  • Create separate user credentials for each user and maintain privacy

  • Provide fine-grained control on shared resources

  • Get a collective bill for all the users under one account

We can use IAM to control DynamoDB resources and API accesses to users. To do so, you...

Limitations in DynamoDB


In this section, we will try to list the limitations put by AWS on DynamoDB operations. These limits need to be considered while using DynamoDB in order to keep your application 100 percent available without any hiccups.

Error handling


In this section, we are going to talk about how to handle errors in DynamoDB. We have seen how to make client requests in earlier chapters of this book. There, we had not put the error-handling mechanism, which we would be doing now.

Type of errors

There are two types of errors in AWS:

  • Client errors: These normally come when the request we are submitting is incorrect. The client errors are normally shown with the status code starting with 4XX. These errors normally arrive when there is an authentication failure, bad requests, missing required attributes, or for exceeding the provisioned throughput. The errors normally come when users provide invalid inputs.

  • Server errors: These arrive when there is something wrong from Amazon's side, and they appear at runtime. The only way to handle such errors is to try again, and even then if it does not succeed, then you should log the request ID and reach Amazon support with that ID to know more about the details.

You can get the full list...

Summary


In this chapter, we started with understanding how to monitor DynamoDB tables; we saw various ways of the DynamoDB status and how to use it to get correct information about DynamoDB all the time. Then, we started with the AWS security model for DynamoDB. There, we talked about implementing security policies based on user roles and applying the same to the application. We went through a stepwise tutorial to create security groups, policies, and applying them on sample DynamoDB tables.

We also went through multiple example security policies, which would help to build a secure app in the near future. We also understood how to create fine-grained access control in real-time applications to maintain the integrity of the system. We also learned about one very interesting topic called web identity federation where we can use third-party websites to use the user identity and allow them to connect to DynamoDB after a successful token verification.

Finally, we listed down the best practices...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering DynamoDB
Published in: Aug 2014Publisher: PacktISBN-13: 9781783551958
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
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 about Tanmay Deshpande

Attribute

Limitation Details

Table name/index name

Table/index name can contain A-Z, a-z, 0-9, underscore (_), dash (-) and dot (.). The table name should be a minimum of 3 and maximum of 255 characters. There is no limit on the table name that starts with the previously mentioned special characters.

Tables per account

You can create a maximum of 256 tables per region through one account.

Table size

There is no limit on the number of items or size of the table in terms of bytes.

Hash key

There is no limit on the number of hash keys in a table.

Range key

There is no limit on the number of range keys per unique hash key for tables without a local secondary index. For a table with a local secondary index, the total size of the table, including...