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"
      }
  • Take screenshots of each Lambda function that includes all of the source code

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
  • Take screenshots of your API Gateway that includes the resources and methods you created
  • Include the endpoint URL for your deployed API in your project submission

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?

Grading Rubric (Total: 50 points)

DynamoDB Setup (10 points)

  • Create BaseballStats table: 5 points
    • Correct table name and primary key (TeamID)
    • Correct sort key (SK)
  • Seed data from 3 files: 5 points
    • Successfully load games.json, teams.json, players.json
    • All records properly inserted

Lambda Functions (12 points)

  • allStats function: 5 points
    • Function named correctly
    • Returns all items from BaseballStats table
    • Proper error handling
  • newTeam function: 5 points
    • Function named correctly
    • Accepts team record parameter
    • Successfully inserts record into DynamoDB
  • Screenshots of Lambda code: 2 points
    • Both functions visible with full source code

API Gateway Configuration (18 points)

  • Create REST API: 2 points
    • API named "BaseballStats-API"
  • GET method (allStats): 4 points
    • Method created and connected to allStats Lambda
    • Proper request/response integration
  • POST method (newTeam): 4 points
    • Method created and connected to newTeam Lambda
    • Proper request/response integration
  • CORS enabled: 3 points
    • CORS properly configured on all resources
  • API Deployment: 3 points
    • Deployed to stage named "baseballStats"
    • Endpoint URL included in submission
  • Screenshots & Documentation: 2 points
    • API Gateway resources and methods visible

Testing & Verification (10 points)

  • Teams rendered: 2.5 points
    • Test application displays all teams correctly
  • Players rendered: 2.5 points
    • Test application displays all players correctly
  • Add new teams: 2.5 points
    • Ability to add new teams through test application
    • No errors during insertion
  • Data persistence: 2.5 points
    • New teams persist in DynamoDB
    • Data visible on subsequent queries

What did I learn?

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