Design a Database for a Mobile App

with Amazon DynamoDB

Module 7: Clean Up

To finish this experiment, you will clean up the resources created in this lab

Overview

In the previous sections, we’ve satisfied the following access patterns in our application:

  • Create user profile (Write)
  • Update user profile (Write)
  • Get user profile (Read)
  • Upload photo (Write)
  • View recent photos for user (Read)
  • React to a photo (Write)
  • View photo and reactions (Read)
  • Follow user (Write)
  • View followers for user (Read)
  • View followed for user (Read)


The strategies we used to satisfy these patterns included:

  • A single-table design that combined multiple entity types in one table.
  • A composite primary key that allow for many-to-many relationships.
  • An inverted index to allow reverse lookups on our many-to-many entity.
  • Partial normalization to keep our data fresh while remaining performant.\
  • DynamoDB transactions to handle complex write patterns across multiple items.

In the steps below, we’ll run through the steps to clean up the resources we created in this lab.

 Time to Complete

20 minutes

Implementation

  • As part of the cleanup process, you need to delete the DynamoDB table you used for this lab.

    In the code you downloaded, there is a file in the scripts/ directory called delete_table.py. The contents of that file are as follows.

    import boto3
    
    dynamodb = boto3.client('dynamodb')
    
    try:
        dynamodb.delete_table(TableName='quick-photos')
        print("Table deleted successfully.")
    except Exception as e:
        print("Could not delete table. Please try again in a moment. Error:")
        print(e)

    In your terminal, run the following command to run this script and delete your table.

    python scripts/delete_table.py
    

    The script should print a message indicating the table was deleted successfully.

  • To delete the AWS Cloud9 environment that you used in this lab: 

    1. Navigate to the AWS Cloud9 console.
    2. Choose the DynamoDB Quick Photos environment and choose Delete
    3. In the dialog box, type Delete in the box, and choose Delete.

Was this page helpful?