我希望我的GuardDuty调查结果发布轻松。我从github链接获得了模板,它工作得很好。现在,我想为每个发现发布更多信息,因此我使用新模板更新了堆栈,但是失败,并显示错误"Zip file cannot exceed 4096 characters. Use S3 instead".
,因此我在模板中使用了S3,它似乎加载了正确的lambda函数,但没有加载将新发现发布到Slack,因为它仅在我手动测试Lambda函数时发布。对于每个新发现或设置的时间,我究竟需要如何提供s3详细信息才能使lambda发布到松弛状态。以下是原始代码和已编辑代码的所有详细信息。
原始模板:https://github.com/aws-samples/amazon-guardduty-to-slack/blob/master/gd2slack.template 编辑后的模板:除了我在下面粘贴的部分之外,所有内容都是相同的
},
"findingsToSlack": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Handler": "index.handler",
"Role": {
"Fn::GetAtt":
},
"Code": {
"S3Bucket": "bucket_name",
"S3Key": "file.zip"
},
"Runtime": "nodejs8.10",
"MemorySize": "128",
"Timeout": "10",
"Description": "Lambda to push GuardDuty findings to slack",
"TracingConfig": {
"Mode": "Active"
我怀疑编辑后的代码中的“代码”属性错误。 当我将代码属性替换为s3bucket和value时,我觉得错误来自原始代码的一部分
"Code": {
"ZipFile": {
"Fn::Join": [
"",
[
"'use strict';\n",
"\n",
"/**\n",
" * Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n",
" *\n",
" * Licensed under the Amazon Software License (the \"License\"). You may not use this file except in compliance with the License.\n",
" * A copy of the License is located at\n",
" * http://aws.amazon.com/asl/\n",
" */\n",
code--------,
]
]
}
},
与"Fn::Join"
??有什么关系..我究竟如何将s3作为代码属性提供,所以我正确地理解了。或有什么办法可以绕过zip文件限制?任何帮助将不胜感激。在此先感谢。