Tracking CodeCommit Metadata with DynamoDB

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this lab, we will complete a system to track CodeCommit commit metadata in the same table it is being logged to.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Examine the `PrometheusMeta` DynamoDB Table

The PrometheusMeta table should begin to have records written to it shortly after starting the lab. Once some data has arrived in the table, examine the attributes to plan how to satisfy the provided metadata requirements.

Modify the `PrometheusMetaStreamProcessor` Lambda Function

Make the necessary changes to the PrometheusMetaStreamProcessor Lambda function to process the DynamoDB Stream records and update the PrometheusMeta DynamoDB table appropriately.

Enable the DynamoDB Stream Trigger

In the Lambda interface for the PrometheusMetaStreamProcessor function, select the DynamoDB Stream trigger and change the disabled/enabled toggle to Enabled. Save your changes.

Verify Metadata Record Creation

Return to the DynamoDB web console and verify that metadata records are being generated as expected (this may take a couple minutes).

Additional Resources

We've been asked to aggregate meaningful metadata from an existing DynamoDB table with raw information about commits to a CodeCommit repository being used to track a writing project. The table has general partition and sort keys named Partition and Sort, both of which are strings. The table stream was enabled before any data was written to the table and should contain records for all the activity on the table. An essentially empty Lambda function has been provided named PrometheusMetaStreamProcessor with a pre-configured DynamoDB stream trigger preconfigured but disabled. We will need to edit the PrometheusMetaStreamProcessor Lambda function and enable the stream trigger. Once this is done, we will confirm that our stream processing is producing the desired results.

Metadata Record Requirements

  • Without clobbering existing records, create a meaningful Partition value.
  • In the Sort attribute, store a value that can be used to easily identify each version of a file committed to the CodeCommit repository.
  • For each file in the repository, it should be possible to always find the latest commit that changed any given file with a specific key.
  • Include an attribute with the commit ID for each record.
  • Include an attribute to identify the commit before the primary commit in the record.

Code used in the solution videos for this lab can be found here.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?