Easy implementation of csv import to AWS Dynamo DB (Windows, free)

Introduction

[Article by Tech Dive](https://tech-dive.xyz/2020/03/22/dynamodb%E3%81%B8csv%E3%83%87%E3%83%BC%E3%82%BF% E3% 82% 92% E7% B0% A1% E5% 8D% 98% E3% 81% AB% E3% 82% A4% E3% 83% B3% E3% 83% 9D% E3% 83% BC% E3% 83% 88% E3% 81% 99% E3% 82% 8B% E6% 96% B9% E6% B3% 95 /) was very helpful. We would like to take this opportunity to thank you.

This article is a memorandum when the above contents are implemented in a Windows environment.

Writer's environment

・ Windows 10 ・ Git Bash

procedure

  1. Install Python3

  2. Install Pandas pip install pandas

  3. Install aws cli I couldn't use the ʻawscommand in Git Bash even after installing it, so in Git Bashcmd \C aws --version` You can use it after hitting and restarting

  4. Confirm access key Create a new access key for import from "My Security Credentials" in the AWS user menu

  5. Registration of access key and secret access key Hit ʻaws configure` and register the access key you created earlier

    aws configure
    
    AWS Access Key ID [None]: [access key]
    AWS Secret Access Key [None]: [Secret access key]
    Default region name [None]: us-east-2 * Region with table
    Default output format [None]: json
    
  6. Change CSV header Match the first line with the database key and specify the type by enclosing it in () Example) If the key is "UserName" (String), UserName (S)

  7. Clone import_to_dynamodb git clone https://github.com/hidesan-xyz/import_to_dynamodb.git

  8. Put the csv file to import in the root of the cloned directory

  9. Create a shell command for import python create_insert_command.py importdata testtable

  1. Execute the created shell command sh ./testtable_import_20200808164839.sh

The above procedure is complete.

Recommended Posts

Easy implementation of csv import to AWS Dynamo DB (Windows, free)
Comparison of Windows Server and Free Linux to Commercial Linux
Easy way to customize Python import
Easy to see difference of json