[{"data":1,"prerenderedAt":227},["ShallowReactive",2],{"content-svc-dynamodb-guides-using-dynamodbto-build-webapps-08-dynamo-cdkinfra":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":14,"menu":15,"menuType":223,"isCollapseableMenu":18,"nextDocItem":134,"previousDocItem":116,"contributorPaths":224,"contentName":226,"slug":133,"readingTime":23},"\u003Ch1>Provision Amazon DynamoDB Table and Indexes with AWS CDK\u003C\u002Fh1>\n\u003Cp>In this section, you will learn how to provision a DynamoDB table and global secondary indexes using \u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Fcdk\u002F\">AWS CDK (Cloud Development Kit)\u003C\u002Fa>. AWS CDK is an infrastructure-as-code framework that allows you to define and provision AWS resources using familiar programming languages.\u003C\u002Fp>\n\u003Cp>Here are the steps to provision the DynamoDB table and indexes using AWS CDK:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cp>\u003Cstrong>Install and configure AWS CDK:\u003C\u002Fstrong> If you haven&#39;t already, install AWS CDK and configure it with your AWS credentials. You can refer to the \u003Ca href=\"https:\u002F\u002Fdocs.aws.amazon.com\u002Fcdk\u002Fv2\u002Fguide\u002Fgetting_started.html\">official AWS CDK documentation\u003C\u002Fa> for installation and setup instructions.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\u003Cp>\u003Cstrong>Create a new CDK project:\u003C\u002Fstrong> Start by creating a new AWS CDK project using your preferred programming language (e.g., TypeScript, Python, Java). This project will contain the infrastructure code for provisioning the DynamoDB table and indexes.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\u003Cp>\u003Cstrong>Write the CDK code:\u003C\u002Fstrong> Write the AWS CDK code that defines the DynamoDB table and indexes. You can use the AWS CDK constructs provided by the AWS SDK for the programming language you&#39;re using. Define the table, primary key attributes, and any global secondary indexes you need. You can refer to the following resources for sample AWS CDK code:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fcdk-migrated-app-infra\u002Ftree\u002FdynamoDB\u002Flib\">AWS CDK DynamoDB Code Examples\u003C\u002Fa>: This GitHub repository contains sample AWS CDK code for provisioning a DynamoDB table and indexes.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003C\u002Fli>\n\u003Cli>\u003Cp>\u003Cstrong>Deploy the infrastructure:\u003C\u002Fstrong> Once you&#39;ve written the AWS CDK code, you can deploy the infrastructure by running the appropriate AWS CDK deployment command. This command will create the DynamoDB table and indexes in your AWS account based on the code you&#39;ve written.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\u003Cp>\u003Cstrong>Test the provisioned DynamoDB table:\u003C\u002Fstrong> After the infrastructure is deployed, you can test the provisioned DynamoDB table by performing various read and write operations using the AWS SDK or other tools. Verify that the table and indexes are functioning as expected and serving your application&#39;s access patterns efficiently.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>By following these steps, you can provision a DynamoDB table and global secondary indexes using AWS CDK. This allows you to define your infrastructure as code and easily manage and replicate your DynamoDB setup across different environments.\u003C\u002Fp>\n",{"title":6,"order":7,"youtubeVideoID":8,"resources":9},"Provision Amazon DynamoDB table and indexes with AWS CDK",9,"4o1KzB2AAk4",[10],{"link":11,"text":12,"type":13},"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fcdk-migrated-app-infra\u002Ftree\u002FdynamoDB\u002Flib","AWS CDK code","code","# Provision Amazon DynamoDB Table and Indexes with AWS CDK\n\nIn this section, you will learn how to provision a DynamoDB table and global secondary indexes using [AWS CDK (Cloud Development Kit)](https:\u002F\u002Faws.amazon.com\u002Fcdk\u002F). AWS CDK is an infrastructure-as-code framework that allows you to define and provision AWS resources using familiar programming languages.\n\nHere are the steps to provision the DynamoDB table and indexes using AWS CDK:\n\n1. **Install and configure AWS CDK:** If you haven't already, install AWS CDK and configure it with your AWS credentials. You can refer to the [official AWS CDK documentation](https:\u002F\u002Fdocs.aws.amazon.com\u002Fcdk\u002Fv2\u002Fguide\u002Fgetting_started.html) for installation and setup instructions.\n\n2. **Create a new CDK project:** Start by creating a new AWS CDK project using your preferred programming language (e.g., TypeScript, Python, Java). This project will contain the infrastructure code for provisioning the DynamoDB table and indexes.\n\n3. **Write the CDK code:** Write the AWS CDK code that defines the DynamoDB table and indexes. You can use the AWS CDK constructs provided by the AWS SDK for the programming language you're using. Define the table, primary key attributes, and any global secondary indexes you need. You can refer to the following resources for sample AWS CDK code:\n\n   - [AWS CDK DynamoDB Code Examples](https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fcdk-migrated-app-infra\u002Ftree\u002FdynamoDB\u002Flib): This GitHub repository contains sample AWS CDK code for provisioning a DynamoDB table and indexes.\n\n4. **Deploy the infrastructure:** Once you've written the AWS CDK code, you can deploy the infrastructure by running the appropriate AWS CDK deployment command. This command will create the DynamoDB table and indexes in your AWS account based on the code you've written.\n\n5. **Test the provisioned DynamoDB table:** After the infrastructure is deployed, you can test the provisioned DynamoDB table by performing various read and write operations using the AWS SDK or other tools. Verify that the table and indexes are functioning as expected and serving your application's access patterns efficiently.\n\nBy following these steps, you can provision a DynamoDB table and global secondary indexes using AWS CDK. This allows you to define your infrastructure as code and easily manage and replicate your DynamoDB setup across different environments.\n",[16,27,56,90,125,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":53,"id":54,"link":55},"AWS AppRunner Demo",3,"jOwQdXbmHC4",[47,50],{"link":48,"text":49,"type":13},"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fnodeexpress-backend-app","NodeJS application code",{"link":51,"type":13,"text":52},"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":57,"collapsible":18,"isCollapsed":19,"content":58},"2.Understanding DynamoDB Basics",[59,75],{"title":60,"order":61,"youtubeVideoID":62,"resources":63,"time":71,"path":72,"id":73,"link":74},"Amazon DynamoDB 101",4,"tkj2r7kFcpM",[64,67],{"link":65,"text":66,"type":38},"https:\u002F\u002Faws.amazon.com\u002Fdynamodb\u002F","Amazon DynamoDB service page",{"link":68,"type":69,"text":70},"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":76,"order":77,"youtubeVideoID":78,"resources":79,"time":23,"path":87,"id":88,"link":89},"Amazon DynamoDB under the hood",5,"ZhXqNcbR4n0",[80,84],{"link":81,"text":82,"type":83},"https:\u002F\u002Fwww.usenix.org\u002Fconference\u002Fatc22\u002Fpresentation\u002Felhemali","Amazon DynamoDB: A Scalable, Predictably Performant, and Fully Managed NoSQL Database Service","article",{"link":85,"type":83,"text":86},"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":91,"collapsible":18,"isCollapsed":19,"content":92},"3.Designing Your DynamoDB Table",[93,104,116],{"title":94,"order":95,"youtubeVideoID":96,"resources":97,"time":71,"path":101,"id":102,"link":103},"Is DynamoDB the right database for you?",6,"TpeP3Cmz5PE",[98],{"link":99,"text":100,"type":83},"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":105,"order":106,"youtubeVideoID":107,"resources":108,"time":23,"path":113,"id":114,"link":115},"Introduction to Single Table Design",7,"lWCch8GEK4E",[109],{"link":110,"text":111,"type":112},"https:\u002F\u002Fyoutu.be\u002FQ6-qWdsa8a4","7 Common DynamoDB Patterns for Modeling and Building an App with Alex De Brie","video","06-dynamodb-singletable","06-dynamodb-singletable.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F06-dynamodb-singletable",{"title":117,"order":118,"youtubeVideoID":119,"resources":120,"time":23,"path":122,"id":123,"link":124},"Design a DynamoDB table with Single Table Design",8,"JLZOI8patlw",[121],{"link":110,"text":111,"type":112},"07-dynamodb-singletable-modeling","07-dynamodb-singletable-modeling.md","\u002Fcontent\u002Fservice\u002Fdynamodb\u002Fguides\u002Fusing-dynamodbto-build-webapps\u002F07-dynamodb-singletable-modeling",{"title":126,"collapsible":18,"isCollapsed":18,"content":127},"4.Implementing DynamoDB in Your Application",[128,134,144,163],{"title":6,"order":7,"youtubeVideoID":8,"resources":129,"time":23,"path":131,"id":132,"link":133},[130],{"link":11,"text":12,"type":13},"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":71,"path":141,"id":142,"link":143},"Code your application",10,"9ftDmRMEfDM",[139],{"link":48,"text":140,"type":13},"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":71,"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":112,"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":11,"text":140,"type":13},{"link":169,"type":112,"text":170},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=B0pDPSQcAf4","Load test your serverless applications | Run Artillery in a Lambda function",{"link":172,"type":112,"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":13},"https:\u002F\u002Fgithub.com\u002Fmavi888\u002Fcdk-migrated-app-infra","Code Repository",{"link":197,"type":112,"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":13},{"link":197,"type":112,"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",1792578866954]