can a s3 object creation event trigger an existing fargate job?

0

I have a set up where an s3 object creation event triggers a lambda and i process the file in s3 with this lambda. as the lambda has a timeout, i'm looking to see, if i can create a fargate job and have same or similar set up. such that a s3 object creation event can trigger this fargate task. I am looking for help on how to hook up the s3 object creation event and the fargate job, such that it triggers the task .

질문됨 2년 전2130회 조회
2개 답변
0

S3 Event Notifications cannot trigger Fargate tasks.
Instead, an object creation event can be put to EventBridge, launching the Fargate task from EventBridge.

https://aws.amazon.com/jp/blogs/aws/new-use-amazon-s3-event-notifications-with-amazon-eventbridge/
https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html

profile picture
hayao-k
답변함 2년 전
  • @hayao-k : thanks . how to pass on the bucket/file information when we trigger the fargate task this way. i have tried s3 object notification with lambda and in lambda , i get the bucket and key info as such in my lambda handler code -> bucket = event['Records'][0]['s3']['bucket']['name']. how to get same information in my python fargate task code?

  • @clouduser See below for examples of Event message structures. https://docs.aws.amazon.com/AmazonS3/latest/userguide/ev-events.html#ev-events-list

    Would it look something like this. bucket = event['detail']['bucket']['name'] key = event['detail']['object']['key']

0

Unlike S3 and Lambda integration, you need to use CloudWatch EventRule to integrate S3 with Fargate.

  1. Create a CloudTrail with only S3 event selector
  2. Create an EventRule on the CloudTrail to trigger Fargate
  3. You can pass the bucket and object name to Fargate by environment variable via container override
profile pictureAWS
전문가
답변함 2년 전

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

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

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

관련 콘텐츠