Using Console
Using CLI
<new_role_name>
with a unique name for the new IAM role and trust-policy.json
with the path to a JSON file containing the trust policy for the role.<function_name>
with the name of the function that needs to be updated and <new_role_arn>
with the ARN of the new IAM role created in step 2.<old_role_name>
with the name of the old shared IAM role that needs to be deleted.By following these steps, you can remediate the misconfiguration of having multiple functions with the same IAM role in AWS.Using Python
aws lambda list-functions
to get a list of all the functions in your account and their associated IAM roles.
aws iam create-role
to create a new IAM role with the necessary permissions for the function.
aws lambda update-function-configuration
to update the function’s configuration and specify the new IAM role.