Search code examples
amazon-web-servicesaws-lambda

Can AWS Lambda be run using an existing IAM role?


According to documentation, an AWS lambda function is run by an "execution role" that is unique to that function. I would like to build and run many lambda functions, and ideally I would like them all to use the same role for permissions, so I don't have to create and maintain multiple disparate permission structures and instead have it centralized in a single role that I can manage through IAM (the functions are similar enough in what permissions they require that this role would not experience permission creep).

Is this possible? If so, how would one go about it?


Solution

  • A lambda execution role is an IAM role with a trust policy that allows the lamba function to invoke it. And indeed this role, just like any other role, can have a one to many relationship, meaning it can be used by multiple lambda functions.

    See more on execution roles: https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html#permissions-executionrole-console