In the previous modules, you built a leaderboard system for an online puzzle game. To build this system, you used:

These tools provide flexible, high-scale solutions to many problems you face when building high-traffic game applications.

In the following steps, you clean up the resources you created in this lab.

Time to Complete Module: 20 Minutes


  • Step 1. Delete AWS Lambda, Amazon API Gateway, and Amazon Cognito resources

    AWS Lambda and AWS API Gateway are billed on a pay-per-use basis, so you won’t be charged for leaving them in your account. Nevertheless, it’s best to clean up resources when you’re done using them.

    In the scripts/ folder, there is a file called delete-resources.sh. This script deletes your Lambda function, your API Gateway REST API, your function’s IAM role, and your Amazon Cognito user pool.

    Execute this script with the following command in your terminal:

    bash scripts/delete-resources.sh

    You should see the following output in your terminal:

    Removing REST API
    Deleting IAM role
    Deleting Lambda function
    Deleting Cognito User Pool
  • Step 2. Delete the Amazon Aurora Serverless database

    Remove the Amazon Aurora Serverless database you created.

    1. Navigate to the RDS console, and in the left pane, choose Databases.
    2. Choose the leaderboard database.
    3. Choose Actions, then choose Delete.
    4. In the confirmation dialog box, for the Create final snapshot option, choose No, and select the I acknowledge check box.
    5. Choose Delete DB cluster.
  • Step 3. Delete the database credentials in AWS Secrets Manager

    Next, delete the database credentials you saved in AWS Secrets Manager.

    1. Navigate to the Secrets Manager console.
    2. Choose the leaderboard-database secret.
    3. Choose Actions, then choose Delete secret.
    4. For safety, Secrets Manager requires a waiting period before a secret is permanently deleted. Use the default period of 30 days and choose Schedule deletion.
  • Step 4. Delete the Amazon ElastiCache instance

    Next, remove the Amazon ElastiCache instance.

    1. Navigate to the ElastiCache console.
    2. Choose Redis.
    3. Choose the leaderboard instance.
    4. Choose Actions, then choose Delete.
    5. In the Delete Cluster confirmation screen, choose Delete to delete the cluster. Do not select the option to create a backup.
  • Step 5. Delete the networking resources

    To enable your Lambda function to access both the ElastiCache instances plus the Data API, you created some networking resources such as a private subnet, a NAT Gateway, route tables, and an Elastic IP address.

    Some of these resources -- like the NAT Gateway and Elastic IP address -- incur costs, so you want to be sure to remove them. There is a file called remove-networking.sh in the scripts/ directory that removes these resources.

    You can execute the script by running the following command in your terminal:

    bash scripts/remove-networking.sh

    You should see the following output in your terminal:

    Disassociating route table
    Deleting route table
    Deleting NAT Gateway
    Sleeping for EIP disassociation
    Releasing Elastic IP
    Networking resources deleted!
  • Step 6. Delete the rule for your AWS Cloud9 environment

    In an earlier module, you added a rule to the ElastiCache security group that allowed access from your Cloud9 instance. In order to delete your Cloud9 instance and security group, you need to delete that rule.

    1. Navigate to the Security Groups portion of the EC2 console.
    2. Find the security group that your ElastiCache instance was using. If you didn't change the standard settings, it should be the security group with the Group Name default.
    3. Select the security group. Then, choose the Inbound tab.
    4. Choose Edit.
    5. In the Edit inbound rules dialog, choose the X icon next to the rule for your Cloud9 instance.
    6. Optional, delete the Lambda rule, as well.
    7. Choose Save.  
  • Step 7. Delete the AWS Cloud9 environment

    Finally, delete the AWS Cloud9 environment that you used in this lab:

    1. Navigate to the AWS Cloud9 console.
    2. Choose the Puzzle Leaderboard environment and choose Delete.
    3. In dialog box, type Delete and choose Delete.