This playbook will guide you through the process of importing data from Excel files into DynamoDB using an intermediary conversion to JSON format.
- Excel files containing the data to be imported.
- AWS DynamoDB table details (table name, region).
-
Ask User for the Excel Data:
- Request users to provide the Excel files containing the data to be imported into DynamoDB.
- Review the structure of the Excel files and ensure that they contain the necessary data to be imported into DynamoDB.
-
Convert Excel Data to JSON:
-
Install pandas and openpyxl libraries if not already installed:
pip install pandas openpyxl
-
Create a Python script to read the Excel files and convert the data to JSON format.
-
-
Verify JSON Data:
- Review the generated JSON data to ensure that it accurately represents the data from the Excel files.
- Verify that the JSON data is well-formatted and does not contain any errors or inconsistencies.
-
Start all the Docker Containers:
- Start the Docker containers for the services that are required for the import process.
- Ensure that the Docker containers are running and accessible before proceeding with the import.
-
Import JSON Data into DynamoDB:
-
Use the
aws dynamodb batch-write-item
command to import the JSON data into the DynamoDB table:aws dynamodb batch-write-item --request-items file://data.json --region <region>
- Replace
data.json
with the path to your JSON file containing the data to be imported. - Replace
<region>
with the AWS region where your DynamoDB table is located.
- Replace
-
-
Verify Data Import:
- Check the DynamoDB table to verify that the data has been successfully imported.
- Verify that the data in DynamoDB matches the data from the Excel files.
-
Clean Up:
- Delete any temporary files or resources created during the import process.
- Ensure that sensitive data is handled securely and not left exposed.
-
Documentation:
- Document the entire import process, including any tools or scripts used for conversion.
- Include instructions for re-importing data in case of any issues or updates.
- Document any considerations or limitations related to the import process.
- Test the data conversion process with a small subset of data before importing the entire dataset.
- Handle any errors or inconsistencies in the Excel data during the conversion process.
- Monitor the import process to ensure that it completes successfully and without errors.
- Follow best practices for data handling and security to protect sensitive information.