You are currently viewing Visualize Amazon DynamoDB insights in Amazon QuickSight utilizing the Amazon Athena DynamoDB connector and AWS Glue

Visualize Amazon DynamoDB insights in Amazon QuickSight utilizing the Amazon Athena DynamoDB connector and AWS Glue

Amazon DynamoDB is a totally managed, serverless, key-value NoSQL database designed to run high-performance functions at any scale. DynamoDB affords built-in safety, steady backups, automated multi-Area replication, in-memory caching, and knowledge import and export instruments. The scalability and versatile knowledge schema of DynamoDB make it well-suited for a wide range of use instances. These embrace internet-scale internet and cell functions, low-latency metadata shops, high-traffic retail web sites, Web of Issues (IoT) and time sequence knowledge, on-line gaming, and extra.

Knowledge saved in DynamoDB is the premise for useful enterprise intelligence (BI) insights. To make this knowledge accessible to knowledge analysts and different shoppers, you should use Amazon Athena. Athena is a serverless, interactive service that lets you question knowledge from a wide range of sources in heterogeneous codecs, with no provisioning effort. Athena accesses knowledge saved in DynamoDB through the open supply Amazon Athena DynamoDB connector. Desk metadata, reminiscent of column names and knowledge varieties, is saved utilizing the AWS Glue Knowledge Catalog.

Lastly, to visualise BI insights, you should use Amazon QuickSight, a cloud-powered enterprise analytics service. QuickSight makes it simple for organizations to construct visualizations, carry out advert hoc evaluation, and shortly get enterprise insights from their knowledge, anytime, on any gadget. Its generative BI capabilities allow you to ask questions on your knowledge utilizing pure language, with out having to write down SQL queries or study a BI software.

This publish exhibits how you should use the Athena DynamoDB connector to simply question knowledge in DynamoDB with SQL and visualize insights in QuickSight.

Resolution overview

The next diagram illustrates the answer structure.

Architecture Diagram

  1. The Athena DynamoDB connector runs in a pre-built, serverless AWS Lambda perform. You don’t want to write down any code.
  2. AWS Glue offers supplemental metadata from the DynamoDB desk. Particularly, an AWS Glue crawler is run to deduce and retailer the DynamoDB desk format, schema, and related properties within the Glue Knowledge Catalog.
  3. The Athena editor is used to check the connector and carry out evaluation through SQL queries.
  4. QuickSight makes use of the Athena connector to visualise BI insights from DynamoDB.

This walkthrough makes use of knowledge from the ProductCatalog desk, a part of the DynamoDB developer information pattern knowledge information.


Earlier than you get began, it’s best to meet the next conditions:

Arrange the Athena DynamoDB connector

The Athena DynamoDB connector includes a pre-built, serverless Lambda perform offered by AWS that communicates with DynamoDB so you may question your tables with SQL utilizing Athena. The connector is on the market within the AWS Serverless Utility Repository, and is used to create the Athena knowledge supply for later use in knowledge evaluation and visualization. To arrange the connector, full the next steps:

  1. On the Athena console, select Knowledge sources within the navigation pane.
  2. Select Create knowledge supply.
  3. Within the search bar, seek for and select Amazon DynamoDB.
  4. Select Subsequent.
  5. Beneath Knowledge supply particulars, enter a reputation. Be aware that this title ought to be distinctive and will likely be referenced in your SQL statements whenever you question your Athena knowledge supply.
  6. Beneath Connection particulars, select Create Lambda perform.

This may take you to the Lambda functions web page on the Lambda console. Don’t shut the Athena knowledge supply creation tab; you’ll return to it in a later step.

  1. Scroll right down to Utility settings and enter a price for the next parameters (depart the opposite parameters as default):
    • SpillBucket – Specifies the Amazon Easy Storage Service (Amazon S3) bucket title for storing knowledge that exceeds Lambda perform response dimension limits. To create an S3 bucket, seek advice from Making a bucket.
    • AthenaCatalogName – A lowercase title for the Lambda perform to be created.Lambda Application Settings
  2. Choose the acknowledgement verify field and select Deploy.

Look ahead to deployment to finish earlier than transferring to the subsequent step.

  1. Return to the Athena knowledge supply creation tab.
  2. Beneath Connection particulars, select the refresh icon and select the Lambda perform you created.Lambda Connection Details
  3. Select Subsequent.
  4. Evaluate and select Create knowledge supply.

Present supplemental metadata through AWS Glue

The Athena connector already comes with a built-in inference functionality to find the schema and desk properties of your knowledge supply. Nevertheless, this functionality is restricted. To precisely uncover the metadata of your DynamoDB desk and centralize schema administration as your knowledge evolves over time, the connector integrates with AWS Glue.

To attain this, an AWS Glue crawler is run to mechanically decide the format, schema, and related properties of the uncooked knowledge saved in your DynamoDB desk, writing the ensuing metadata to a Glue database. Glue databases include tables, which maintain metadata from completely different knowledge shops, impartial from the precise location of the information. The Athena connector then references the Glue desk and retrieves the corresponding DynamoDB metadata to allow queries.

Create the AWS Glue database

Full the next steps to create the Glue database:

  1. On the AWS Glue console, underneath Knowledge Catalog within the navigation pane, select Databases.
  2. Select Add database (you can even edit an present database if you have already got one).
  3. For Title, enter a database title.
  4. For Location, enter the string literal dynamo-db-flag. This key phrase signifies that the database incorporates tables that the connector can use for supplemental metadata.
  5. Select Create database.

Following safety finest practices, it’s also really helpful that you just allow encryption at relaxation in your Knowledge Catalog. For particulars, seek advice from Encrypting your Knowledge Catalog.

Create the AWS Glue crawler

Full the next steps to create and run the Glue crawler:

  1. On the AWS Glue console, underneath Knowledge Catalog within the navigation pane, select Crawlers.
  2. Select Create crawler.
  3. Enter a crawler title and select Subsequent.
  4. For Knowledge sources, select Add a knowledge supply.
  5. On the Knowledge supply drop-down menu, select DynamoDB. For Desk title, enter the title of your DynamoDB desk (string literal).
  6. Select Add a DynamoDB knowledge supply.
  7. Select Subsequent.
  8. For IAM Function, select Create new IAM function.
  9. Enter a job title and select Create. This may mechanically create an IAM function that trusts AWS Glue and has permissions to entry the crawler targets.
  10. Select Subsequent.
  11. For Goal database, select the database beforehand created.
  12. Select Subsequent.
  13. Evaluate and select Create crawler.
  14. On the newly created crawler web page, select Run crawler.

Crawler runtimes rely in your DynamoDB desk dimension and properties. Yow will discover crawler run particulars underneath Crawler runs.

Validate the output metadata

When your crawler run standing exhibits as Accomplished, observe the under steps to validate the output metadata:

  1. On the AWS Glue console, select Tables within the navigation pane. Right here, you may affirm a brand new desk has been added to the database because of the crawler run.
  2. Navigate to the newly created desk and try the Schema tab. This tab exhibits the column names, knowledge varieties, and different parameters inferred out of your DynamoDB desk.
  3. If wanted, edit the schema by selecting Edit schema.Glue Table Details
  4. Select Superior properties.
  5. Beneath Desk properties, confirm the crawler mechanically created and set the classification key to dynamodb. This means to the Athena connector that the desk can be utilized for supplemental metadata.
  6. Optionally, add the next properties to appropriately catalog and reference DynamoDB knowledge in AWS Glue and Athena queries. This is because of capital letters not being permitted in AWS Glue desk and column names, however being permitted in DynamoDB desk and attribute names.
    1. In case your DynamoDB desk title incorporates any capital letters, select Actions and Edit Desk and add an additional desk property as follows:
      • Key: sourceTable
      • Worth: YourDynamoDBTableName
    2. In case your DynamoDB desk has attributes that include any capital letters, add an additional desk property as follows:
      • Key: columnMapping
      • Worth: yourcolumn1=YourColumn1, yourcolumn2=YourColumn2, …

Check the connector with the Athena SQL editor

After the Athena DynamoDB connector is deployed and the AWS Glue desk is populated with supplemental metadata, the DynamoDB desk is prepared for evaluation. The instance on this publish makes use of the Athena editor to make SQL queries to the ProductCatalog desk. For additional choices to work together with Athena, see Accessing Athena.

Full the next steps to check the connector:

  1. Open the Athena question editor.
  2. If that is your first time visiting the Athena console in your present AWS Area, full the next steps. It is a prerequisite earlier than you may run Athena queries. See Getting Began for extra particulars.
    1. Select Question editor within the navigation pane to open the editor.
    2. Navigate to Settings and select Handle to arrange a question consequence location in Amazon S3.
  3. Beneath Knowledge, choose the information supply and database you created (you might want to decide on the refresh icon for them to sync up with Athena).
  4. Tables belonging to the chosen database seem underneath Tables. You may select a desk title for Athena to indicate the desk column checklist and knowledge varieties.
  5. Check the connector by pulling knowledge out of your desk through a SELECT assertion. While you run Athena queries, you may reference Athena knowledge sources, databases, and tables as <datasource_name>.<database>.<table_name>. Retrieved information are proven underneath Outcomes.

For elevated safety, seek advice from Encrypting Athena question outcomes saved in Amazon S3 to encrypt question outcomes at relaxation.

Athena Query Results

For this publish, we run a SELECT assertion to validate the method. You may seek advice from the SQL reference for Athena to construct extra complicated queries and analyses.

Visualize in QuickSight

QuickSight permits for constructing fashionable interactive dashboards, paginated experiences, embedded analytics, and pure language queries by means of a unified BI answer. On this step, we use QuickSight to generate visible insights from the DynamoDB desk by connecting to the Athena knowledge supply beforehand created.

Enable QuickSight to entry to assets

Full the next steps to grant QuickSight entry to assets:

  1. On the QuickSight console, select the profile icon and select Handle QuickSight.
  2. Within the navigation pane, select Safety & Permissions.
  3. Beneath QuickSight entry to AWS companies, select Handle.
  4. QuickSight might ask you to modify to the Area during which customers and teams in your account are managed. To vary the present Area, navigate to the profile icon on the QuickSight console and select the Area you need to change to.
  5. For IAM Function, select Use QuickSight-managed function (default).

Subsequent directions assume that the default QuickSight-managed function is getting used. If this isn’t the case, ensure that to replace the prevailing function to the identical impact.

  1. Beneath Enable entry and autodiscovery for these assets, choose IAM and Amazon S3.
  2. For Amazon S3, select Choose S3 buckets.
  3. Select the spill bucket you laid out in earlier when deploying the Lambda perform for the connector and the bucket you specified because the Athena question consequence location in Amazon S3.
  4. For each buckets, choose Write permission for Athena Workgroup.
  5. Select Amazon Athena.
  6. Within the pop-up window, select Subsequent.
  7. Select Lambda and select the Amazon Useful resource Title (ARN) of the Lambda perform beforehand used for the Athena knowledge supply connector.
  8. Select End.
  9. Select Save.

Create the Athena dataset

To create the Athena dataset, full the next steps:

  1. On the QuickSight console, select the person profile and change to the Area you deployed the Athena knowledge supply to.
  2. Return to the QuickSight dwelling web page.
  3. Within the navigation pane, select Datasets.
  4. Select New dataset.
  5. For Create a Dataset, choose Athena.
  6. For Knowledge supply title, enter a reputation and select Validate connection.
  7. When the connection exhibits as Validated, select Create knowledge supply.
  8. Beneath Catalog, Database, and Tables, choose the Athena knowledge supply, AWS Glue database, and AWS Glue desk beforehand created.
  9. Select Choose.
  10. On the End dataset creation web page, choose Import to SPICE for faster analytics.
  11. Select Visualize.

For added data on QuickSight question modes, see Importing knowledge into SPICE and Utilizing SQL to customise knowledge.

Construct QuickSight visualizations

As soon as the DynamoDB knowledge is on the market in QuickSight through the Athena DynamoDB connector, it is able to be visualized. The QuickSight evaluation within the under instance exhibits a vertical stacked bar chart with the typical worth per product class for the ProductCatalog pattern dataset. As well as, it exhibits a donut chart with the proportion of merchandise by product class, and a tree map containing the rely of bicycles per bicycle sort.

In the event you use knowledge imported to SPICE in a QuickSight evaluation, the dataset will solely be accessible after the import is full. For additional particulars, see Utilizing SPICE knowledge in an evaluation.

Quicksight Analysis

For complete data on how one can create and share visualizations in QuickSight, seek advice from Visualizing knowledge in Amazon QuickSight and Sharing and subscribing to knowledge in Amazon QuickSight.

Clear up

To keep away from incurring continued AWS utilization expenses, be sure to delete all assets created as a part of this walkthrough.

  • Delete the Athena knowledge supply:
    1. On the Athena console, change to the Area you deployed your assets in.
    2. Select Knowledge sources within the navigation pane.
    3. Choose the information supply you created and on the Actions menu, select Delete.
  • Delete the Lambda software:
    1. On the AWS CloudFormation console, change to the Area you deployed your assets in.
    2. Select Stacks within the navigation pane.
    3. Choose serverlessrepo-AthenaDynamoDBConnector and select Delete.
  • Delete the AWS Glue assets:
    1. On the AWS Glue console, change to the Area you deployed your assets in.
    2. Select Databases within the navigation pane.
    3. Choose the database you created and select Delete.
    4. Select Crawlers within the navigation pane.
    5. Choose the crawler you created and on the Motion menu, select Delete crawler.
  • Delete the QuickSight assets:
    1. On the QuickSight console, change to the Area you deployed your assets in.
    2. Delete the evaluation created for this walkthrough.
    3. Delete the Athena dataset created for this walkthrough.
    4. In the event you not want the Athena knowledge supply to create different datasets, delete the information supply.


This publish demonstrated how you should use the Athena DynamoDB connector to question knowledge in DynamoDB with SQL and construct visualizations in QuickSight.

Be taught extra concerning the Athena DynamoDB connector within the Amazon Athena Person Information. Uncover extra accessible knowledge supply connectors to question and visualize a wide range of knowledge sources with out establishing or managing any infrastructure whereas solely paying for the queries you run.

For superior QuickSight capabilities powered by AI, see Gaining insights with machine studying (ML) in Amazon QuickSight and Answering enterprise questions with Amazon QuickSight Q.

Concerning the Authors

Antonio Samaniego Jurado is a Options Architect at Amazon Net Companies. With a robust ardour for contemporary know-how, Antonio helps prospects construct state-of-the-art functions on AWS. A creator at coronary heart, he loves community-driven studying and sharing of finest practices throughout the AWS service portfolio to make the very best of consumers cloud journey.

Pascal Vogel is a Options Architect at Amazon Net Companies. Pascal helps startups and enterprises construct cloud-native options. As a cloud fanatic, Pascal loves studying new applied sciences and connecting with like-minded prospects who need to make a distinction of their cloud journey.

Leave a Reply