@@ -120,7 +120,7 @@ export class BatchReplayer extends Construct {
120
120
this . dataset = props . dataset ;
121
121
this . frequency = props . frequency ?. toSeconds ( ) || 60 ;
122
122
this . sinkBucket = props . sinkBucket ;
123
- this . sinkObjectKey = props . sinkObjectKey ;
123
+ this . sinkObjectKey = this . sinkObjectKey ? ` ${ this . sinkObjectKey } / ${ this . dataset . tableName } ` : this . dataset . tableName ;
124
124
this . outputFileMaxSizeInBytes = props . outputFileMaxSizeInBytes || 100 * 1024 * 1024 ; //Default to 100 MB
125
125
126
126
const dataWranglerLayer = LayerVersion . fromLayerVersionArn ( this , 'PandasLayer' , `arn:aws:lambda:${ Aws . REGION } :336392948345:layer:AWSDataWrangler-Python39:1` ) ;
@@ -200,10 +200,8 @@ export class BatchReplayer extends Construct {
200
200
} ) ;
201
201
202
202
// grant permissions to write to the bucket and to use the KMS key
203
- const putPattern = this . sinkObjectKey ? `${ this . sinkObjectKey } /*` : undefined ;
204
- this . sinkBucket . grantWrite ( writeInBatchFn , putPattern ) ;
203
+ this . sinkBucket . grantWrite ( writeInBatchFn , `${ this . sinkObjectKey } /*` ) ;
205
204
206
- const sinkPath = this . sinkObjectKey ? `${ this . sinkObjectKey } /${ this . dataset . tableName } ` : this . dataset . tableName ;
207
205
const writeInBatchFnTask = new LambdaInvoke ( this , 'WriteInBatchFnTask' , {
208
206
lambdaFunction : writeInBatchFn ,
209
207
payload : TaskInput . fromObject ( {
@@ -219,7 +217,7 @@ export class BatchReplayer extends Construct {
219
217
// For file processing
220
218
dateTimeColumnToFilter : this . dataset . dateTimeColumnToFilter ,
221
219
dateTimeColumnsToAdjust : this . dataset . dateTimeColumnsToAdjust ,
222
- sinkPath : this . sinkBucket . s3UrlForObject ( sinkPath ) ,
220
+ sinkPath : this . sinkBucket . s3UrlForObject ( this . sinkObjectKey ) ,
223
221
outputFileMaxSizeInBytes : 20480 ,
224
222
} ) ,
225
223
// Retry on 500 error on invocation with an interval of 2 sec with back-off rate 2, for 6 times
0 commit comments