1

Aws lambda 和 CLI 均返回“InternalServerErrorException:调用 UpdateThreatIntelSet 操作时发生错误 (InternalServerErrorException):请求被拒绝,因为调用者无权调用此 API。” IAM 政策已设置为允许管理员操作,并且受信任的实体设置为 s3、lambda、guardduty、Apigateway。几天来,我一直在寻找为什么它一直给我拒绝,而我已经明确允许一切。非常感谢任何建议或帮助。下面是代码片段和来自 lambda 的拒绝

from __future__ import print_function
import boto3

detector_id = 'abcdefghijklmnop12345'
threatIntelSetIds = 'abcdefghijklmnop12345'
mal_ip = '10.0.0.0'

# Update threatIntelsetId based on the malicious_ip addresses.
def update_threatList(threatIntelSetIds, mal_ip):
client = boto3.client('guardduty')
response = client.update_threat_intel_set(
    Activate=True,
    DetectorId=detector_id,
    ThreatIntelSetId=threatIntelSetIds
)

def lambda_handler(event, context):
    update_threatList(threatIntelSetIds, mal_ip)

这是拒绝IAM 政策受信任的实体

4

1 回答 1

1

如评论中所述,此令人困惑的错误消息的可能原因(我已使用 Terraform 和 CloudFormation 资源来管理 GuardDuty 进行了复制)是 S3 位置不存在。

另外,请注意,S3 存储桶中的完整路径需要存在,特别是 CloudFormation 不会在那里创建一个空文件,如果该文件尚不存在。

这通常意味着 CloudFormation 以外的其他进程需要创建文件。

于 2019-08-30T10:33:41.800 回答