Aws lambda and CLI both returned "InternalServerErrorException: An error occurred (InternalServerErrorException) when calling the UpdateThreatIntelSet operation: The request is rejected because the caller is not authorized to call this API." IAM policy already been set to allow Admin action and Trusted entities are set to s3, lambda, guardduty, Apigateway. I've been searching for days now on why it keeps giving me that rejection where I already explicitly allow everything. Any advise or help is greatly appreciated. Below is the code snippet and the rejection from 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)