Introduction

Introduction

In our fictitious TravelBuddy web application, we stored all of our application data in a MySQL database hosted in Amazon RDS. But as we migrate to a microservices architecture, we need to consider breaking this monolithic database up into smaller pieces. This also gives us the opportunity to choose the right datastore for the way our data needs to be accessed - and embrace Polyglot Persistence.

We will create a new microservice that exposes trip sector information so that clients can query for ‘all trips’ or ‘trips from city’. This could be used in the scenario where our clients may want to know what cities can be reached from a given origin. As an optional Challenge Exercise, you are tasked with extending this functionality to also provide the ability to search for flights that are destined for a particular city.

Instead of storing this information in a relational database, we will use the Amazon DynamoDB service. In this lab we will take a look at how to access Amazon DynamoDB from Java using the AWS SDK for Java, hosted in AWS Lambda.

We will then turn our attention to AWS Step Functions and experiment with creating state machines to create managed workflows. The state machine will call Lambda functions to perform tasks.

Amazon DynamoDB

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. DynamoDB lets you offload the administrative burdens of operating and scaling a distributed database, so that you don’t have to worry about hardware provisioning, setup and configuration, replication, software patching, or cluster scaling.

With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of request traffic. You can scale up or scale down your tables’ throughput capacity without downtime or performance degradation, and use the AWS Management Console to monitor resource utilization and performance metrics.

AWS Step Functions

We will also explore how to use AWS Step Functions to create workflows. AWS Step Functions makes it easy to coordinate the components of distributed applications and microservices using visual workflows. Building applications from individual components that each perform a discrete function lets you scale and change applications quickly. Step Functions is a reliable way to coordinate components and step through the functions of your application. Step Functions provides a graphical console to arrange and visualize the components of your application as a series of steps. This makes it simple to build and run multistep applications. Step Functions automatically triggers and tracks each step, and retries when there are errors, so your application executes in order and as expected. Step Functions logs the state of each step, so when things do go wrong, you can diagnose and debug problems quickly. You can change and add steps without even writing code, so you can easily evolve your application and innovate faster.

Content

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

  • Use the AWS SDK for Java to scan an Amazon DynamoDB Table to return results
  • Use the AWS SDK for Java to query an Amazon DynamoDB Table to return results that match a criteria
  • Understand how you can use Indexes in a DynamoDB table to perform lookups on attributes other than the partition key
  • Create a DynamoDB table manually using the console, and populate the data manually
  • Create a workflow using AWS Step Functions
  • Create AWS Lambda functions that provide Task actions for Step Functions

Technical Knowledge Prerequisites

To successfully complete this lab, you should be familiar with basic navigation of the AWS Management Console and have intermediate experience using the Eclipse IDE and the Java Programming language.

Environment

All the resources required to begin this lab have already been provisioned and set up for you. If running in your own account, use this CloudFormation template The following diagram depicts the resources that were deployed in your AWS account. Architecture