in pipeline_utils.py [0:0]
def add_notif(bucket, prefix, lambda_fcn_arn):
print('Initialising Amazon S3 Bucket client ...')
bucket_notification = s3_resource.BucketNotification(bucket)
print('SUCCESS: Successfully initilised Amazon S3 Bucket client!')
print('Setting up notifications on Amazon S3 Bucket')
setup_notif = bucket_notification.put(
NotificationConfiguration={
'LambdaFunctionConfigurations': [
{
'LambdaFunctionArn': lambda_fcn_arn,
'Events': ['s3:ObjectCreated:Put','s3:ObjectCreated:CompleteMultipartUpload'],
'Filter': {
'Key': {
'FilterRules': [
{
'Name': 'suffix',
'Value': '.csv'
},
{
'Name': 'prefix',
'Value': prefix
}
]
}
}
}
]
}
)
print('SUCCESS: Successfully added notifications to Amazon S3 Bucket!')