Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Generating a CSV Report from a DynamoDB Table

In this lab, you will walk through the creation of a Lambda function that can read the first 1000 items from your DynamoDB table and export them as a CSV into your S3 bucket. You will have to grant your Lambda function the appropriate permissions to be able to access both the database and the S3 bucket. If you are not interested in learning about the code, you can copy the code from the GitHub repository provided and only complete the permissions part of the lab. You can find the Lambda code and the JSON permissions file in the **Additional Resources** section of the lab.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Dec 16, 2022

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Copy Your S3 Bucket's Amazon Resource Name

    • Navigate to the S3 service.
    • Click on the S3 bucket created for the lab.
    • Record the bucket's Amazon Resource Name (ARN).
  2. Challenge

    Create a Lambda Function That Reads 1000 Lines from Your DynamoDB Table and Exports Them to a CSV File in Your S3 Bucket

    • Navigate to the Lambda service.
    • Create a new function with a Python runtime (or the runtime of your choice).
    • Write and deploy the code needed to scan 1000 items from your DynamoDB table.
  3. Challenge

    Give Your Lambda Function Permissions to Read from Your DynamoDB Table and Write to Your S3 Bucket

    • From your Lambda function, navigate to the Configuration tab.
    • From the Permissions view, create a new policy for the Lambda's execution role.
    • Write a policy that grants your Lambda function Write access to your S3 bucket and Read access from your DynamoDB table.
    • Attach this new permissions policy to your Lambda execution role.
  4. Challenge

    Test Your Lambda Function and Verify That the CSV File Is Created in Your S3 Bucket

    • Navigate back to your Lambda function.
    • From the Test tab, execute a test, which should now succeed.
    • Navigate to your S3 bucket and verify the presence of the generated CSV file.
  5. Challenge

    Add Items to Your DynamoDB Table

    • Navigate to the DynamoDB service.
    • Navigate to the DynamoDB table created for this lab.
    • From the Explore table items interface, add 3 or more items to your DynamoDB table to test the solution.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans