The error message “NoSuchEntity: Policy arn:aws:iam::aws:policy/AWSLambdaRole” typically occurs when the AWS Identity and Access Management (IAM) policy or role that is associated with a Lambda function is not found or has been deleted.
To resolve this issue, you can try the following steps:
- Check the IAM policy and role associated with the Lambda function: Make sure that the policy and role exist and have not been deleted. You can do this by logging in to the AWS Management Console and navigating to the IAM console, then checking the Policies and Roles pages.
- Check the Lambda function configuration: Ensure that the correct IAM role is assigned to the function. You can check this by opening the Lambda function in the AWS Management Console, navigating to the “Permissions” tab, and checking the “Execution role” field.
- Create a new IAM policy and role: If the policy or role has been deleted, you can create a new one and assign it to the Lambda function. You can do this by navigating to the IAM console, creating a new policy or role, and updating the Lambda function configuration to use the new policy or role.