File Monitoring

0

I am trying to create a webapp that will monitor a local file and send information to a dynamodb table when a new file or folder is created. What AWS service would be best suited for this?

preguntada hace 2 años199 visualizaciones
2 Respuestas
0

It is easy to implement if you are storing the files as objects in S3. S3 has a feature called Event Notifications - https://docs.aws.amazon.com/AmazonS3/latest/userguide/NotificationHowTo.html

You can create a lambda function that will get invoked whenever an S3 Event Notification is received. This lambda function can go and create/update an entry in DynamoDB - https://docs.aws.amazon.com/lambda/latest/dg/with-s3.html

Note that S3 does not have the notion of folders. S3 has the notion of prefixes that comprise the key to the objects and give the impression that they are like folders in a file system.

profile pictureAWS
EXPERTO
respondido hace 2 años
0

Hi.

@Indranil shows how to detect file creation on S3. I will answer how to detect local files.

In this case, you do not need to use any special AWS services additionally.

We'll look at how local file detection works, and then he'll simply use the AWS SDK to create records in DynamoDB.

However, since it operates as a local monitoring process, it is better to run it as a server-side daemon program separate from the Web Application.

For example, when implementing using .NET, you can detect the creation and modification of files and folders by using the FileSystemWatcher class. Hook that event and access Dynamo DB with the AWS SDK .NET.

https://stackoverflow.com/questions/67214771/how-to-use-filesystemwatcher-on-linux-with-net-5-0

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CodeSamples.DotNet.html

However, if the storage created can be offloaded to S3, an easier way is to use S3 Notifications to run the Lambda as @Indranil mentions.

profile picture
EXPERTO
iwasa
respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas