[{"data":1,"prerenderedAt":227},["ShallowReactive",2],{"content-svc-dynamodb-guides-using-dynamodbto-build-webapps-07-dynamodb-singletable-modeling":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":14,"menu":15,"menuType":223,"isCollapseableMenu":18,"nextDocItem":123,"previousDocItem":105,"contributorPaths":224,"contentName":226,"slug":119,"readingTime":23},"\u003Ch1>Design a DynamoDB Table with Single Table Design\u003C\u002Fh1>\n\u003Cp>In this section, you will learn how to design a DynamoDB table using the single table design approach. By following these steps, you can efficiently model your data for maximum performance and scalability.\u003C\u002Fp>\n\u003Cp>Here is an overview of the steps involved in designing a DynamoDB table with single table design:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cp>\u003Cstrong>Create an Entity-Relationship Diagram (ERD):\u003C\u002Fstrong> Start by creating an ERD that visualizes the relationships between your entities. This diagram will help you understand the structure of your data and identify the primary entities and their attributes.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\u003Cp>\u003Cstrong>Identify Access Patterns:\u003C\u002Fstrong> Determine all the access patterns required by your application. This involves identifying the different ways you need to retrieve and manipulate data from the table. Consider the types of queries you&#39;ll need to perform and the data you&#39;ll need to retrieve for each query.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\u003Cp>\u003Cstrong>Model the Primary Key Structure:\u003C\u002Fstrong> Design the primary key structure based on your identified access patterns. The primary key consists of a partition key and an optional sort key. Choose meaningful attribute(s) that will allow you to efficiently retrieve the required data for each access pattern. You may need to denormalize your data and duplicate it in different parts of the table to optimize query performance.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\u003Cp>\u003Cstrong>Satisfy Additional Access Patterns:\u003C\u002Fstrong> In some cases, you may have access patterns that cannot be efficiently satisfied with the primary key alone. In such cases, consider using secondary indexes or DynamoDB streams to address these additional access patterns. Secondary indexes allow you to query the table using different attributes, while streams enable capturing and processing changes to the table in real-time.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>You can also refer to the following resource for more information:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fyoutu.be\u002FQ6-qWdsa8a4\">7 Common DynamoDB Patterns for Modeling and Building an App with Alex De Brie\u003C\u002Fa>: This video provides insights into various patterns and strategies for effectively modeling your data in DynamoDB.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>By following these steps and considering your application&#39;s requirements, you can design a DynamoDB table using the single table design approach, resulting in a highly performant and scalable data model.\u003C\u002Fp>\n\u003Cp>Remember to adapt these steps to your specific use case and consult the provided resources for more detailed guidance.\u003C\u002Fp>\n",{"title":6,"order":7,"youtubeVideoID":8,"resources":9},"Design a DynamoDB table with Single Table Design",8,"JLZOI8patlw",[10],{"link":11,"text":12,"type":13},"https:\u002F\u002Fyoutu.be\u002FQ6-qWdsa8a4","7 Common DynamoDB Patterns for Modeling and Building an App with Alex De Brie","video","# Design a DynamoDB Table with Single Table Design\n\nIn this section, you will learn how to design a DynamoDB table using the single table design approach. By following these steps, you can efficiently model your data for maximum performance and scalability.\n\nHere is an overview of the steps involved in designing a DynamoDB table with single table design:\n\n1. **Create an Entity-Relationship Diagram (ERD):** Start by creating an ERD that visualizes the relationships between your entities. This diagram will help you understand the structure of your data and identify the primary entities and their attributes.\n\n2. **Identify Access Patterns:** Determine all the access patterns required by your application. This involves identifying the different ways you need to retrieve and manipulate data from the table. Consider the types of queries you'll need to perform and the data you'll need to retrieve for each query.\n\n3. **Model the Primary Key Structure:** Design the primary key structure based on your identified access patterns. The primary key consists of a partition key and an optional sort key. Choose meaningful attribute(s) that will allow you to efficiently retrieve the required data for each access pattern. You may need to denormalize your data and duplicate it in different parts of the table to optimize query performance.\n\n4. **Satisfy Additional Access Patterns:** In some cases, you may have access patterns that cannot be efficiently satisfied with the primary key alone. In such cases, consider using secondary indexes or DynamoDB streams to address these additional access patterns. Secondary indexes allow you to query the table using different attributes, while streams enable capturing and processing changes to the table in real-time.\n\nYou can also refer to the following resource for more information:\n\n- [7 Common DynamoDB Patterns for Modeling and Building an App with Alex De Brie](https:\u002F\u002Fyoutu.be\u002FQ6-qWdsa8a4): This video provides insights into various patterns and strategies for effectively modeling your data in DynamoDB.\n\nBy following these steps and considering your application's requirements, you can design a DynamoDB table using the single table design approach, resulting in a highly performant and scalable data model.\n\nRemember to adapt these steps to your specific use case and consult the provided resources for more detailed guidance.\n",[16,27,57,91,120,177,215],{"title":17,"collapsible":18,"isCollapsed":19,"content":20},"Introduction",false,true,[21],{"title":17,"order":22,"time":23,"path":24,"id":25,"link":26},1,"2 min","introduction","introduction.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002Fintroduction",{"title":28,"collapsible":18,"isCollapsed":19,"content":29},"1. Hosting Your Application with App Runner",[30,42],{"title":31,"order":32,"youtubeVideoID":33,"resources":34,"time":23,"path":39,"id":40,"link":41},"What is AWS App Runner?",2,"z-RywG7Xfk8",[35],{"link":36,"text":37,"type":38},"https:\u002F\u002Faws.amazon.com\u002FApp Runner\u002F","AWS App Runner","service","01-apprunnerintro","01-apprunnerintro.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F01-apprunnerintro",{"title":43,"order":44,"youtubeVideoID":45,"resources":46,"time":23,"path":54,"id":55,"link":56},"AWS AppRunner Demo",3,"jOwQdXbmHC4",[47,51],{"link":48,"text":49,"type":50},"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fnodeexpress-backend-app","NodeJS application code","code",{"link":52,"type":50,"text":53},"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fcdk-migrated-app-infra\u002Ftree\u002Fapprunner","AWS CDK infrastructure code","02-apprunnerdemo","02-apprunnerdemo.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F02-apprunnerdemo",{"title":58,"collapsible":18,"isCollapsed":19,"content":59},"2.Understanding DynamoDB Basics",[60,76],{"title":61,"order":62,"youtubeVideoID":63,"resources":64,"time":72,"path":73,"id":74,"link":75},"Amazon DynamoDB 101",4,"tkj2r7kFcpM",[65,68],{"link":66,"text":67,"type":38},"https:\u002F\u002Faws.amazon.com\u002Fdynamodb\u002F","Amazon DynamoDB service page",{"link":69,"type":70,"text":71},"https:\u002F\u002Faws.amazon.com\u002Fdynamodb\u002Fpricing\u002F","pricing","Amazon DynamoDB pricing","3 min","03-dynamodb-intro","03-dynamodb-intro.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F03-dynamodb-intro",{"title":77,"order":78,"youtubeVideoID":79,"resources":80,"time":23,"path":88,"id":89,"link":90},"Amazon DynamoDB under the hood",5,"ZhXqNcbR4n0",[81,85],{"link":82,"text":83,"type":84},"https:\u002F\u002Fwww.usenix.org\u002Fconference\u002Fatc22\u002Fpresentation\u002Felhemali","Amazon DynamoDB: A Scalable, Predictably Performant, and Fully Managed NoSQL Database Service","article",{"link":86,"type":84,"text":87},"https:\u002F\u002Fwww.theregister.com\u002F2022\u002F11\u002F14\u002Fmeet_the_database_that_supports\u002F","Meet the database that supports Amazon.com","04-dynamodb-underthehood","04-dynamodb-underthehood.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F04-dynamodb-underthehood",{"title":92,"collapsible":18,"isCollapsed":18,"content":93},"3.Designing Your DynamoDB Table",[94,105,114],{"title":95,"order":96,"youtubeVideoID":97,"resources":98,"time":72,"path":102,"id":103,"link":104},"Is DynamoDB the right database for you?",6,"TpeP3Cmz5PE",[99],{"link":100,"text":101,"type":84},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fdatabase\u002Fhow-to-determine-if-amazon-dynamodb-is-appropriate-for-your-needs-and-then-plan-your-migration\u002F","How to determine if Amazon DynamoDB is appropriate for your needs, and then plan your migration","05-dynamo-rightforyou","05-dynamo-rightforyou.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F05-dynamo-rightforyou",{"title":106,"order":107,"youtubeVideoID":108,"resources":109,"time":23,"path":111,"id":112,"link":113},"Introduction to Single Table Design",7,"lWCch8GEK4E",[110],{"link":11,"text":12,"type":13},"06-dynamodb-singletable","06-dynamodb-singletable.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F06-dynamodb-singletable",{"title":6,"order":7,"youtubeVideoID":8,"resources":115,"time":23,"path":117,"id":118,"link":119},[116],{"link":11,"text":12,"type":13},"07-dynamodb-singletable-modeling","07-dynamodb-singletable-modeling.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F07-dynamodb-singletable-modeling",{"title":121,"collapsible":18,"isCollapsed":19,"content":122},"4.Implementing DynamoDB in Your Application",[123,134,144,163],{"title":124,"order":125,"youtubeVideoID":126,"resources":127,"time":23,"path":131,"id":132,"link":133},"Provision Amazon DynamoDB table and indexes with AWS CDK",9,"4o1KzB2AAk4",[128],{"link":129,"text":130,"type":50},"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fcdk-migrated-app-infra\u002Ftree\u002FdynamoDB\u002Flib","AWS CDK code","08-dynamo-cdkinfra","08-dynamo-cdkinfra.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F08-dynamo-cdkinfra",{"title":135,"order":136,"youtubeVideoID":137,"resources":138,"time":72,"path":141,"id":142,"link":143},"Code your application",10,"9ftDmRMEfDM",[139],{"link":48,"text":140,"type":50},"Get the code","09-dynamodb-app","09-dynamodb-app.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F09-dynamodb-app",{"title":145,"order":146,"youtubeVideoID":147,"resources":148,"time":72,"path":160,"id":161,"link":162},"How to Migrate Data to DynamoDB?",11,"qEQqL3KiOOc",[149,153,157],{"link":150,"text":151,"type":152},"https:\u002F\u002Fdocs.aws.amazon.com\u002Famazondynamodb\u002Flatest\u002Fdeveloperguide\u002FS3DataImport.HowItWorks.html","DynamoDB data import from Amazon S3: how it works","docs",{"link":154,"text":155,"type":156},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fdatabase\u002Fperforming-a-live-migration-from-a-mongodb-cluster-to-amazon-dynamodb\u002F","Performing a Live Migration from a MongoDB Cluster to Amazon DynamoDB","blog",{"link":158,"type":13,"text":159},"https:\u002F\u002Fyoutu.be\u002F_6ym3IRrRxo","🆕 Step functions Distributed map - Run 10k parallel serverless executions!","10-dynamodb-migrate","10-dynamodb-migrate.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F10-dynamodb-migrate",{"title":164,"order":165,"youtubeVideoID":33,"resources":166,"time":23,"path":174,"id":175,"link":176},"Deploy and Load Test",12,[167,168,171],{"link":129,"text":140,"type":50},{"link":169,"type":13,"text":170},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=B0pDPSQcAf4","Load test your serverless applications | Run Artillery in a Lambda function",{"link":172,"type":13,"text":173},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=0VNKHIcQ5wk","Building Amazon CloudWatch dashboards with AWS CDK","11-dynamodb-test","11-dynamodb-test.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F11-dynamodb-test",{"title":178,"collapsible":18,"isCollapsed":19,"content":179},"5.Adding Event-Driven Characteristics",[180,188,202],{"title":181,"order":182,"youtubeVideoID":183,"time":184,"path":185,"id":186,"link":187},"DynamoDB Streams",13,"M0GJzjsw5So","1 min","12-dynamo-streams","12-dynamo-streams.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F12-dynamo-streams",{"title":189,"order":190,"youtubeVideoID":191,"resources":192,"time":184,"path":199,"id":200,"link":201},"Acting on Stream Events",14,"RL0l2Wz3deQ",[193,196],{"link":194,"text":195,"type":50},"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fcdk-migrated-app-infra","Code Repository",{"link":197,"type":13,"text":198},"https:\u002F\u002Fyoutu.be\u002F8Yv_V4havbc","Unlock the Power of EventBridge Pipes: Integrate Across Platforms with Ease!","13-dynamodb-ebpipes","13-dynamodb-ebpipes.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F13-dynamodb-ebpipes",{"title":203,"order":204,"youtubeVideoID":205,"resources":206,"time":184,"path":212,"id":213,"link":214},"Filtering Subscription Messages",15,"36iMOJQUAuE",[207,210,211],{"link":208,"text":209,"type":156},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fintroducing-payload-based-message-filtering-for-amazon-sns\u002F","Introducing payload-based message filtering for Amazon SNS",{"link":194,"text":195,"type":50},{"link":197,"type":13,"text":198},"14-dynamodb-sns","14-dynamodb-sns.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F14-dynamodb-sns",{"title":216,"collapsible":18,"isCollapsed":19,"content":217},"Conclusion",[218],{"title":216,"order":219,"time":184,"path":220,"id":221,"link":222},16,"conclusion","conclusion.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002Fconclusion","LIST",[225],"content\u002Fcontributors\u002Fmarcia-villalba.json","Using DynamoDB to build WebApps",1792578866940]