Current Students, visit the student website for the information you need.
Student Portal

Project 3 - Lambda, API Gateway & DynamoDB

Objectives

  • Create & Manage DynamoDB Tables
  • Create Lambda functions
  • Create an API using API Gateway

Supporting Files

Project Overview

You have a successful big data (focused on baseball) startup and you have customers asking for access to your data. Your plan is to provide access to your data through an API created in API Gateway. Initially, the plan is to provide read access as well as allowing users to add new records to your dataset. You have a customer that is willing to pay for access as long as you are able to provide a working proof-of-concept based on their javascript front-end.

Project Details

DynamoDB

  • Create a DynamoDB table named BaseballStats - primary key of TeamID and sort key of SK. You can do this from either the graphical interface within the AWS console or using the AWS CLI to create the table from a command line / terminal interface.
  • Seed the BaseballStats table with data contained from these 3 files:
    1. games.json
    2. teams.json
    3. players.json

Lambda

  • Create a Lambda function named allStats that returns a collection of all items in the BaseballStats table
  • Create a Lambda function named newTeam that takes a team record as an incoming parameter and inserts it into the BaseballStats table. The team record will look like the following:
      {
          TeamID: "TEAMINFO_LAA",
          SK: "LAA",
          TeamName: "Los Angeles Angels"
      }

API Gateway

  • Create REST API within API Gateway named BaseballStats-API
  • Within your BaseballStats-API, create a method (GET) that is connected to the allStats Lambda function
  • Within your BaseballStats-API, create a method (POST) that is connected to the newTeam Lambda function
  • Enable CORS for your BaseballStats-API
  • Deploy your BaseballStats-API to a new stage named baseballStats

Tests and Verification

  • Does my test application render all of the teams?
  • Does my test application render all of the players?
  • Am I able to add new teams using the test application?
  • When I add a new team, is the data persistent?

What did I learn?

  • Creating and Managing DynamoDB tables
  • Accessing DynamoDB data from Lambda
  • Providing Access to Lambda through API Gateway