[英]Enable/Disable or delete aws lambda trigger on s3:Objectcreated.* using python
I have a lambda function that triggers when any new objectCreated(s3:Objectcreated.*) in a Bucket A-prod, This lambda process the file saves the result in B-prod.我有一个 lambda function,当 Bucket A-prod 中的任何新对象创建(s3:Objectcreated.*)时触发,这个 lambda 处理文件将结果保存在 B-prod 中。
Now I want to restore this data on QA, I am writing a script for same and I don't want to process file again.现在我想在 QA 上恢复这些数据,我正在为此编写一个脚本,我不想再次处理文件。 For my case I will copy B-prod to B-qa and A-prod to A-qa via a python script.
对于我的情况,我将通过 python 脚本将 B-prod 复制到 B-qa,将 A-prod 复制到 A-qa。
can't find how to do it from python or cli.
无法从 python 或 cli 找到如何执行此操作。
In boto3 you use put_bucket_notification_configuration to provide empty notifications.在 boto3 中,您使用put_bucket_notification_configuration来提供空通知。
For anyone looking for a temporary disable from AWS console without deleting the trigger, here's a work-around.对于希望在不删除触发器的情况下从 AWS 控制台临时禁用的任何人,这里有一个解决方法。 Note that this is not meant as a permanent solution.
请注意,这并不意味着永久解决方案。 I had to disable temporarily and it works.
我不得不暂时禁用并且它有效。
Go to S3 > Buckets > your-bucket > Properties Go 到 S3 > 桶 > 你的桶 > 属性
Scroll down to "Event Notifications"向下滚动到“事件通知”
You should see your Lambda Function in Destination, Choose Edit, Uncheck "All Object Create Events", Check another event type that will not occur in your process, such as "Object Tagging", Save.您应该在目标中看到您的 Lambda Function,选择编辑,取消选中“所有 Object 创建事件”,选中另一个不会在您的过程中发生的事件类型,例如“对象标记”,保存。
When finished, enable by checking the "Object Create Events" and unchecking the other event.完成后,通过选中“对象创建事件”并取消选中其他事件来启用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.