liveBook · Manning

Principle of least privilege

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

Least privilege is a security principle that grants an identity only the permissions required for its intended tasks.

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

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": "ec2:TerminateInstances",
    "Resource":
 "arn:aws:ec2:us-east-1:111111111111:instance/i-0b5c991e026104db9"
  }]
}

Inspect a policy that grants one EC2 action on one identified instance instead of granting unrestricted EC2 access. section 5.3.3

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Defines IAM policies through actions and resources, then applies them to users, groups, and roles; it does not cover application security.
Examples
Uses EC2 termination, EC2 tagging from Lambda, ARN-specific policies, and IAM groups for administrator access.
What it assumes
Assumes basic AWS access concepts while introducing IAM users, groups, policies, roles, and resource-specific permissions.
What you can do after
Apply it via IAM policies and roles to authorize only required AWS actions and resources.
How it connects
Connects IAM policies, IAM users, IAM groups, IAM roles, Lambda, Amazon Resource Names, and temporary credentials.

Also explained in

Compare how 17 books explain principle of least privilege →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.