Instead of the AWS AWSLambdaBasicExecutionRole Managed Policy, use a custom execution role that allows only the logging and support actions the specific Lambda function needs. Avoid attaching the same basic role to every function without review, because it can become a default permission set rather than a minimum one. Scope each role to one function or one workload family.
Why a custom Lambda execution role is the right least-privilege pattern
A Lambda execution role should be designed around one function’s real runtime needs, not around a broad managed policy that is convenient to reuse. The direct answer here is to keep the permission set narrow: logging, diagnostics, and any other explicit AWS API calls that the function truly requires. That shifts the control from “default access” to “purpose-built access.”
This is the same design principle behind AWS IAM Policies and Roles Guide, which separates policy evaluation, role trust, and scoped permission design. For Lambda, that means the role should exist to support one workload’s behaviour, not to become a reusable shortcut for every function in the account.
Using a custom role also forces a clearer review of what the function actually touches. If a function only writes logs and reads one queue, those are the only permissions that should appear. If another function needs a different support action set, it should receive a different role rather than inheriting a generic baseline that is wider than necessary.
What should be in scope, and what should stay out
The practical test is whether the function can complete its job without the permission. If the answer is no, include it. If the permission is only there because a platform template expects it or because another Lambda used it once, leave it out. That is especially important for shared roles, where one function’s convenience becomes another function’s unnecessary exposure.
Scope the role to the smallest meaningful boundary. In many environments, that boundary is one function; in others, it may be one workload family with the same logging and support pattern. The key is that the role should not become a standing permission pool for unrelated code paths, deployment stages, or teams.
Where Lambda functions interact with broader identity and access patterns, the same least-privilege rule applies to service access more generally. NHIMG’s IAM and IGA Basics explains why entitlements should be reviewed in context rather than granted as defaults, and that logic carries directly into execution-role design for serverless workloads.
Why reuse becomes a security problem
The danger in the basic managed policy is not that logging access is inherently unsafe, but that repeat use turns a narrow helper into an organisation-wide default. Once that happens, the role stops expressing intent and starts expressing convenience. Over time, that makes it easier for a compromised function, bad deployment, or accidental code path to inherit permissions it never needed.
That is why the safer model is per-function design with explicit review of every action. When a role is created for a specific workload, excess permissions are easier to spot, easier to remove, and easier to explain during audit or incident review. A generic role can hide that drift until it matters.
For teams that need a broader control lens, NHIMG’s Privileged Access Management Guide is useful because it treats privilege as something to bound, time-box, and review. The same idea applies to Lambda roles even when the identity is machine-driven rather than human-driven.
Risk and Threat Considerations
Overbroad execution roles turn a small application issue into a larger cloud exposure problem. If a Lambda function is compromised, any extra permissions on its role become available to the attacker, which can extend the blast radius from one function to other resources, logs, queues, secrets, or management APIs.
Failure mechanism: a reusable managed policy is attached as a default instead of a reviewed, purpose-built role, so unnecessary permissions remain available after deployment, refactoring, or workload growth.
Impact: compromise of one function can produce broader unauthorized access, easier lateral movement within the account, and harder incident containment because the role no longer reflects the function’s minimum needed authority.
Why a custom Lambda execution role is the right least-privilege pattern
A Lambda execution role should be designed around one function’s real runtime needs, not around a broad managed policy that is convenient to reuse. The direct answer here is to keep the permission set narrow: logging, diagnostics, and any other explicit AWS API calls that the function truly requires. That shifts the control from “default access” to “purpose-built access.”
This is the same design principle behind AWS IAM Policies and Roles Guide, which separates policy evaluation, role trust, and scoped permission design. For Lambda, that means the role should exist to support one workload’s behaviour, not to become a reusable shortcut for every function in the account.
Using a custom role also forces a clearer review of what the function actually touches. If a function only writes logs and reads one queue, those are the only permissions that should appear. If another function needs a different support action set, it should receive a different role rather than inheriting a generic baseline that is wider than necessary.
What should be in scope, and what should stay out
The practical test is whether the function can complete its job without the permission. If the answer is no, include it. If the permission is only there because a platform template expects it or because another Lambda used it once, leave it out. That is especially important for shared roles, where one function’s convenience becomes another function’s unnecessary exposure.
Scope the role to the smallest meaningful boundary. In many environments, that boundary is one function; in others, it may be one workload family with the same logging and support pattern. The key is that the role should not become a standing permission pool for unrelated code paths, deployment stages, or teams.
Where Lambda functions interact with broader identity and access patterns, the same least-privilege rule applies to service access more generally. NHIMG’s IAM and IGA Basics explains why entitlements should be reviewed in context rather than granted as defaults, and that logic carries directly into execution-role design for serverless workloads.
Why reuse becomes a security problem
The danger in the basic managed policy is not that logging access is inherently unsafe, but that repeat use turns a narrow helper into an organisation-wide default. Once that happens, the role stops expressing intent and starts expressing convenience. Over time, that makes it easier for a compromised function, bad deployment, or accidental code path to inherit permissions it never needed.
That is why the safer model is per-function design with explicit review of every action. When a role is created for a specific workload, excess permissions are easier to spot, easier to remove, and easier to explain during audit or incident review. A generic role can hide that drift until it matters.
For teams that need a broader control lens, NHIMG’s Privileged Access Management Guide is useful because it treats privilege as something to bound, time-box, and review. The same idea applies to Lambda roles even when the identity is machine-driven rather than human-driven.
Risk and Threat Considerations
Overbroad execution roles turn a small application issue into a larger cloud exposure problem. If a Lambda function is compromised, any extra permissions on its role become available to the attacker, which can extend the blast radius from one function to other resources, logs, queues, secrets, or management APIs.
Failure mechanism: a reusable managed policy is attached as a default instead of a reviewed, purpose-built role, so unnecessary permissions remain available after deployment, refactoring, or workload growth.
Impact: compromise of one function can produce broader unauthorized access, easier lateral movement within the account, and harder incident containment because the role no longer reflects the function’s minimum needed authority.
Practitioner Guidance
What to verify: Check the function’s actual AWS API calls, not the template or module defaults. If the code only needs CloudWatch Logs plus one or two explicit service actions, the role should stop there.
Decision rule: If two functions do not have the same runtime permissions requirement, do not share the same execution role. A shared role is only defensible when the workload family is genuinely identical in access needs and lifecycle.
Practitioner takeaway: Least privilege for Lambda is not about swapping one AWS policy for another, it is about making each execution role describe one workload’s real authority and nothing more.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5, CIS Controls v8 and CSA Cloud Controls Matrix set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Covers credential and secret lifecycle for function roles and supporting access material. |
| AC-6 — Least Privilege | Directly matches the need to scope each execution role to only required actions. | |
| Recommendation — Limit Lambda role credentials and rotate supporting secrets on a defined lifecycle. Remove any permissions the Lambda function does not strictly need. | ||
| ISO/IEC 27001:2022 | A.5.15 — Access control | Requires access to be limited according to business need and role purpose. |
| Recommendation — Define execution roles with explicit access rules tied to each function's purpose. | ||
| CIS Controls v8 | CIS-6 — Access Control Management | Supports managing and right-sizing access permissions for cloud workloads. |
| Recommendation — Review Lambda permissions regularly and revoke unnecessary access paths. | ||
| CSA Cloud Controls Matrix | IAM — Identity and Access Management | Cloud IAM control domain governs workload permissions and role scoping. |
| Recommendation — Use cloud IAM controls to assign a dedicated role per Lambda workload. | ||
Practitioner Guidance
What to verify: Check the function’s actual AWS API calls, not the template or module defaults. If the code only needs CloudWatch Logs plus one or two explicit service actions, the role should stop there.
Decision rule: If two functions do not have the same runtime permissions requirement, do not share the same execution role. A shared role is only defensible when the workload family is genuinely identical in access needs and lifecycle.
Practitioner takeaway: Least privilege for Lambda is not about swapping one AWS policy for another, it is about making each execution role describe one workload’s real authority and nothing more.
Related resources from NHI Mgmt Group
- What should be used instead of the AWS AmazonBedrockLimitedAccess managed policy for least privilege?
- What should be used instead of the AWS AmazonDynamoDBFullAccess managed policy for least privilege?
- What should be used instead of the AWS AmazonBedrockReadOnly managed policy for least privilege?
- What should be used instead of the AWS AmazonEKSVPCResourceController managed policy for least privilege?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 20, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org