简体   繁体   English

如何使用 S3 和 Slack 集成编写 AWS lambda 函数

[英]How to write a AWS lambda function with S3 and Slack integration

I have a use case where i want to invoke my lambda function whenever a object has been pushed in S3 and then push this notification to slack.我有一个用例,我想在 S3 中推送对象时调用我的 lambda 函数,然后将此通知推送到 slack。

I know this is vague but how can i start doing so ?我知道这很模糊,但我该如何开始呢? How can i basically achieve this ?我怎样才能基本上做到这一点? I need to see the structure我需要看看结构

There are a lot of resources available for both integrations (s3+lambda and lambda+slack) so if you can put these together you can make it work.有很多资源可用于两种集成(s3+lambda 和 lambda+slack),所以如果你能把它们放在一起,你就可以让它工作。

You can use S3 Event Notifications to trigger a lambda function directly: http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html您可以使用 S3 事件通知直接触发 lambda 函数: http : //docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html

Here are some blueprints to integrate lambda with slack: https://aws.amazon.com/blogs/aws/new-slack-integration-blueprints-for-aws-lambda/以下是将 lambda 与 slack 集成的一些蓝图: https : //aws.amazon.com/blogs/aws/new-slack-integration-blueprints-for-aws-lambda/

Good luck!祝你好运!

You can use S3 Event Notifications to trigger the lambda function.您可以使用 S3 事件通知来触发 lambda 函数。 In bucket's properties, create a new event notification for an event type of s3:ObjectCreated:Put and set the destination to a Lambda function.在存储桶的属性中,为s3:ObjectCreated:Put事件类型创建新的事件通知,并将目标设置为 Lambda 函数。 Then for the lambda function, write a code either in Python or NodeJS (or whatever you like) and parse the received event and send it to Slack webhook URL.然后对于 lambda 函数,用 Python 或 NodeJS(或任何你喜欢的)编写代码并解析接收到的事件并将其发送到 Slack webhook URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM