@@ -130,7 +130,7 @@ Implement these functions:
130130
1311311 . Preparing data from external resources for the data transformation can be done by using ` sls dynamodt prepare `
132132
133- Run ` sls dynamodt prepare --mNumber <transformation_number> --table <table> ` \
133+ Run ` sls dynamodt prepare --tNumber <transformation_number> --table <table> ` \
134134 The data will be stored in a S3 bucket \
135135 The data will be decrypted while running the data transformation script.
136136
@@ -155,8 +155,20 @@ First of all, keep in mind that our mission is to prevent downtime while executi
155155- To be continued...
156156
157157### Troubleshooting
158- To be continued
159-
158+ Credentials error:
159+ #### Required environment variables: #Move it to the tool docs
160+ ``` bash
161+ # configure aws credentials aws configure or use environment variables
162+ export AWS_ACCESS_KEY_ID=< your-access-key-id>
163+ export AWS_SECRET_ACCESS_KEY=< your-secret-access-key>
164+ export AWS_DEFAULT_REGION=< your-region>
165+
166+ # [OPTIONAL]
167+ # Required for preparing data for the migration
168+ # The default is migrations-preparation-data
169+ # Make sure you have created the bucket before running the migration
170+ export PREPARATION_DATA_BUCKET=< your-bucket-name>
171+ ```
160172
161173### Data Transformation Script Format (e.g v1_script.js)
162174``` js
@@ -182,7 +194,7 @@ const prepare = async ({ ddb, isDryRun }) => {
182194module .exports = {
183195 transformUp,
184196 transformDown,
185- prepare,
197+ prepare, // optional
186198 transformationNumber: 1 ,
187199}
188200```
@@ -196,7 +208,7 @@ https://github.com/jitsecurity/dynamo-data-transform/tree/main/examples/serverle
196208#### Insert records
197209
198210``` js
199- // Seed users data migration
211+ // Seed users data transformation
200212const { utils } = require (' dynamo-data-transform' );
201213const { USERS_DATA } = require (' ../../usersData' );
202214
@@ -217,38 +229,38 @@ const transformDown = async ({ ddb, isDryRun }) => {
217229module .exports = {
218230 transformUp,
219231 transformDown,
220- migrationNumber : 1 ,
232+ transformationNumber : 1 ,
221233};
222234```
223235
224236#### Add a new field to each record
225237``` js
226- // Adding a "randomNumber " field to each item
238+ // Adding a "randotNumber " field to each item
227239const { utils } = require (' dynamo-data-transform' );
228240
229241const TABLE_NAME = ' UsersExample' ;
230242
231243const transformUp = async ({ ddb, isDryRun }) => {
232- const addRandomNumberField = (item ) => {
233- const updatedItem = { ... item, randomNumber : Math .random () };
244+ const addRandotNumberField = (item ) => {
245+ const updatedItem = { ... item, randotNumber : Math .random () };
234246 return updatedItem;
235247 };
236- return utils .transformItems (ddb, TABLE_NAME , addRandomNumberField , isDryRun);
248+ return utils .transformItems (ddb, TABLE_NAME , addRandotNumberField , isDryRun);
237249};
238250
239251const transformDown = async ({ ddb, isDryRun }) => {
240- const removeRandomNumberField = (item ) => {
241- const { randomNumber , ... oldItem } = item;
252+ const removeRandotNumberField = (item ) => {
253+ const { randotNumber , ... oldItem } = item;
242254 return oldItem;
243255 };
244- return utils .transformItems (ddb, TABLE_NAME , removeRandomNumberField , isDryRun);
256+ return utils .transformItems (ddb, TABLE_NAME , removeRandotNumberField , isDryRun);
245257};
246258
247259module .exports = {
248260 transformUp,
249261 transformDown,
250- // prepare, // pass this function only if you need preparation data for the migration
251- migrationNumber : 2 ,
262+ // prepare, // pass this function only if you need preparation data for the transformation
263+ transformationNumber : 2 ,
252264};
253265```
254266
@@ -333,7 +345,7 @@ module.exports = {
333345 transformUp,
334346 transformDown,
335347 prepare,
336- migrationNumber : 3 ,
348+ transformationNumber : 4 ,
337349};
338350```
339351
0 commit comments