The principle of least privilege grants each identity only the permissions required for its intended tasks. In AWS, this limits accidental or deliberate damage from users, scripts, and application components. section 5.0 section 5.3.4
Apply the principle by:
- Replacing broad managed policies with custom inline policies when their wildcard Resource settings grant more access than necessary. section 5.3.3
- Restricting policies to the required actions, such as ec2:TerminateInstances, and to specific resources identified by Amazon Resource Names. section 5.3.3
- Giving each person a suitable IAM user and organizing shared authorization through groups rather than using the root user. section 5.3.4
- Creating an IAM role for each Lambda function and granting only the AWS services, actions, and resources that function needs. section 6.3.4
A narrowly scoped Lambda permission
A Lambda function that adds an ownership tag to an EC2 instance needs ec2:CreateTags rather than broad EC2 administration. Its role receives temporary credentials during invocation, and its policy should be narrowed to the required resource whenever possible. section 6.3.4
Inspect a policy that grants one EC2 action on one identified instance instead of granting unrestricted EC2 access. section 5.3.3
















