Menu
Amazon DynamoDB
Getting Started Guide (API Version 2012-08-10)

JavaScript and DynamoDB

In this tutorial, you use JavaScript to write simple programs to perform the following Amazon DynamoDB operations:

  • Create a table called Movies and load sample data in JSON format.

  • Perform create, read, update, and delete operations on the table.

  • Run simple queries.

You use the downloadable version of DynamoDB in this tutorial. In the Summary, we explain how to run the same code against the DynamoDB web service.

Cost: Free

Prerequisites

  • Read Introduction to DynamoDB Concepts.

  • Download and run DynamoDB on your computer. For more information, see Download and Run DynamoDB.

  • Set up the AWS SDK for JavaScript. To do this, add or modify the following script tag to your HTML pages:

    <script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.16.min.js"></script>

    Note

    The version of AWS SDK for JavaScript might have been updated. For the latest version, see the AWS SDK for JavaScript API Reference.

  • Enable CORS (Cross-Origin Resource Sharing) so communication between your computer's browser and the downloadable version of DynamoDB can occur.

    To do this and run the tutorial on your computer:

    1. Download the free ModHeader Chrome browser extension (or any other browser extension that allows you to modify HTTP response headers).

    2. Run the ModHeader Chrome browser extension and add a HTTP response header with the name set to "Access-Control-Allow-Origin" and a value of "null" or "*".

      Important

      This configuration is required only while running the tutorial program for JavaScript on your computer. After you are done with the tutorial, you should disable or remove this configuration.

    3. You can now run the JavaScript tutorial program files.

As you work through this tutorial, you can refer to the AWS SDK for JavaScript API Reference.

If you prefer to run a complete version of the JavaScript tutorial program instead of performing step-by-step instructions, do the following:

  1. Download the following file: MoviesJavaScript.zip.

  2. Extract the file MoviesJavaScript.html from the archive.

  3. Modify the MoviesJavaScript.html file to use your endpoint.

  4. Run the MoviesJavaScript.html file.