Skip to content

The deployed lambda will perform take a JSON array and for each item it will insert a record into Amazon DynamoDB. There is a sample JSON file named `fileToImport` that you can modify from the Lambda Console and add your custom content to.

Notifications You must be signed in to change notification settings

waclock/json-to-dynamo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-to-dynamodb

The deployed lambda will perform take a JSON array and for each item it will insert a record into Amazon DynamoDB. There is a sample JSON file named fileToImport that you can modify from the Lambda Console and add your custom content to.

Deploy to your account in the AWS Console using the Serverless Application Repository

Caution!

This Lambda performs a Put event for every record in your array. If you are importing a large table you will want to know the following:

  1. If you have set provisioned throughput, all these Put requests may hit the limit. The import will not complete if this happens.
  2. The larger the JSON file, the more power you should give your Lambda. Consider bumping the memory of your lambda to a higher setting if you get an error similar to:
Runtime exited with error: signal: killed
  1. If you have a large JSON file the operation may take a longer time. If you experience a timeout in your Lambda, increase your timeout duration.

Assumptions

This assumes you already have a JSON file ready to paste into the console and a DynamoDB table published with a key that matches one of your JSON keys

Publishing a new version

In order to publish a new version you must generate an output yaml that will be used by AWS serverless repo. You can do this by running:

aws cloudformation package --template-file template.yaml --s3-bucket my-cool-bucket --output-template output.yaml

Make sure you give the necessary permissions to your bucket, by adding a policy like the following to your bucket:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "serverlessrepo.amazonaws.com"
      },
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-cool-bucket/*"
    }
  ]
}

About

The deployed lambda will perform take a JSON array and for each item it will insert a record into Amazon DynamoDB. There is a sample JSON file named `fileToImport` that you can modify from the Lambda Console and add your custom content to.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%