menu
arrow_back

Serverless Web Apps using Amazon DynamoDB - Part 1

55m access · 35m completion
Connection Details

Warning: Do not transmit data into the AWS Console that is not related to Qwiklabs or the lab you are taking.

1 Credit

info_outline
This lab costs 1 Credit to run. You can purchase credits or a subscription under My Account.

00:55:00

Serverless Web Apps using Amazon DynamoDB - Part 1

SPL-132 - Version 2.0.3

© 2018 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in part, without prior written permission from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.

Errors or corrections? Email us at aws-course-feedback@amazon.com.

Other questions? Contact us at https://aws.amazon.com/contact-us/aws-training/

Overview

Calling all AWS super heroes! Build a mission dossier generator using DynamoDB in this three-part series of labs using DynamoDB. You hold in your hands step-by-step instructions for completing Part 1. In this lab, you will build the infrastructure you will need in the next two labs. You will create a DynamoDB table and add data, and then review the necessary IAM roles and policies that you will use to grant secure access to this data.

In labs 2 and 3, you will create Lambda functions that interact with DynamoDB, build an API through the API Gateway service, and finally publish an app to the public web, utilizing all of the DynamoDB skills you learn through the three labs. At the end of part 3, you will be able to generate mission dossiers and send super heroes off to save the world!

Topics covered

By the end of this lab you will be able to:

  • Create an Amazon DynamoDB table
  • Add items to your Amazon DynamoDB table
  • Understand the structure of IAM roles and policies needed to access your table

Prerequisites

You should familiarize yourself with key concepts by taking the Introduction to Amazon DynamoDB and Introduction to AWS Identity and Access Management (IAM) labs. This is the first in a three-part series of labs. Each of the three labs can stand alone, but because the labs build upon what you learned previously, taking all three in order is the best learning experience.

Other AWS Services

Other AWS Services than the ones needed for this lab are disabled by IAM policy during your access time in this lab. In addition, the capabilities of the services used in this lab are limited to what’s required by the lab and in some cases are even further limited as an intentional aspect of the lab design. Expect errors when accessing other services or performing actions beyond those provided in this lab guide.

Amazon DynamoDB

Amazon DynamoDB is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale. It is a fully managed cloud database and supports both document and key-value store models. Its flexible data model and reliable performance make it a great fit for mobile, web, gaming, ad tech, IoT, and many other applications.

You can use Amazon DynamoDB to create a database table that can store and retrieve any amount of data, and serve any level of request traffic. Amazon DynamoDB automatically spreads the data and traffic for the table over a sufficient number of servers to handle the request capacity specified by the customer and the amount of data stored, while maintaining consistent and fast performance.

DynamoDB Terminology

Tables Similar to other database management systems, DynamoDB stores data in tables. A table is a collection of data. For example, in this lab you will create a table named SuperMission, where you will store mission information. You could also have a People table to store data about friends, family, or anyone else of interest, or a Cars table to store information about vehicles that people drive.

Items Each table contains multiple items. An item is a group of attributes that is uniquely identifiable among all of the other items. In a People table, each item would represent one person. For a Cars table, each item represents one vehicle. Items are similar in many ways to rows, records, or tuples in relational database systems. In DynamoDB, there is no limit to the number of items that you can store in a table.

Attributes Each item is composed of one or more attributes. An attribute is a fundamental data element, something that does not need to be broken down any further. In this lab, you will create a Mission item with attributes like SuperHero, MissionStatus, Villain1, Villain2, Villain3 and SecretIdentity. As another example, a Department item might have attributes such as DepartmentID, Name, Manager, and so on. An item in a People table could contain attributes such as PersonID, LastName, FirstName, and so on. Attributes in DynamoDB are similar in many ways to fields or columns in other database management systems.

Primary Key When you create a table, in addition to the table name, you must specify the primary key of the table. As in other databases, a primary key in DynamoDB uniquely identifies each item in the table, so that no two items can have the same key. When you add, update, or delete an item in the table, you must specify the primary key attribute values for that item. The key values are required; you cannot omit them. DynamoDB supports two different kinds of primary keys: Partition Key and Partition Key and Sort Key.

Secondary Indexes In DynamoDB, you can read data in a table by providing primary key attribute values. If you want to read the data using non-key attributes, you can use a secondary index to do this. After you create a secondary index on a table, you can read data from the index in much the same way as you do from the table. By using secondary indexes, your applications can use many different query patterns, in addition to accessing the data by primary key values.

AWS Identity and Access Management Documentation

AWS Identity and Access Management (IAM) is a web service that enables Amazon Web Services (AWS) customers to manage users and user permissions in AWS. The service is targeted at organizations with multiple users or systems in the cloud that use AWS products such as Amazon DynamoDB, AWS Lambda, and the AWS Management Console. With IAM, you can centrally manage users, security credentials such as access keys, and permissions that control which AWS resources users can access. For more information, see https://aws.amazon.com/iam/.

AWS Lambda

AWS Lambda is a compute service that provides resizable compute capacity in the cloud to make web-scale computing easier for developers. Upload your code to AWS Lambda and AWS Lambda takes care of provisioning and managing the servers that you use to run the code. AWS Lambda supports multiple coding languages: Node.js, Java, or Python. You can use AWS Lambda in two ways:

  • As an event-driven compute service where AWS Lambda runs your code in response to events, such as uploading image files as you’ll see in this lab.
  • As a compute service to run your code in response to HTTP requests using Amazon API Gateway or API calls.

AWS Lambda passes on the financial benefits of Amazon’s scale to you. Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second. Lambda makes it easy to build data processing triggers for AWS services like Amazon S3 and Amazon DynamoDB, process streaming data stored in Amazon Kinesis, or create your own back end that operates at AWS scale, performance, and security.

This lab guide explains basic concepts of AWS in a step by step fashion. However, it can only give a brief overview of Lambda concepts. For further information, see the official Amazon Web Services Documentation for Lambda at https://aws.amazon.com/documentation/lambda/. For pricing details, see https://aws.amazon.com/lambda/pricing/.

Start Lab

Notice the lab properties below the lab title:

  • setup - The estimated time to set up the lab environment
  • access - The time the lab will run before automatically shutting down
  • completion - The estimated time the lab should take to complete
  1. At the top of your screen, launch your lab by clicking Start Lab

If you are prompted for a token, use the one distributed to you (or credits you have purchased).

A status bar shows the progress of the lab environment creation process. The AWS Management Console is accessible during lab resource creation, but your AWS resources may not be fully available until the process is complete.

  1. Open your lab by clicking Open Console

This will automatically log you into the AWS Management Console.

Please do not change the Region unless instructed.

Common login errors

Error : Federated login credentials

If you see this message:

  • Close the browser tab to return to your initial lab window
  • Wait a few seconds
  • Click Open Console again

You should now be able to access the AWS Management Console.

Error: You must first log out

If you see the message, You must first log out before logging into a different AWS account:

  • Click click here
  • Close your browser tab to return to your initial Qwiklabs window
  • Click Open Console again

Join Qwiklabs to read the rest of this lab...and more!

  • Get temporary access to the Amazon Web Services Console.
  • Over 200 labs from beginner to advanced levels.
  • Bite-sized so you can learn at your own pace.
Join to Start This Lab
home
Home
school
Catalog
menu
More
More