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)