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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠