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?

質問済み 2年前199ビュー
2回答
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
エキスパート
回答済み 2年前
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
エキスパート
iwasa
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ