0
0
AWScloud~20 mins

Least privilege principle in AWS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Least Privilege Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
security
intermediate
2:00remaining
Identify the IAM policy that follows least privilege

Which IAM policy grants the least privilege necessary for a Lambda function to read items from a specific DynamoDB table?

A{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["dynamodb:DeleteItem"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Orders"}]}
B{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": "dynamodb:*", "Resource": "*"}]}
C{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["dynamodb:GetItem", "dynamodb:Query"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Orders"}]}
D{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["dynamodb:GetItem"], "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Orders"}]}
Attempts:
2 left
💡 Hint

Focus on granting only the actions needed and restrict the resource to the specific table.

Best Practice
intermediate
2:00remaining
Choosing the right IAM role for EC2 instance access

You want an EC2 instance to upload files only to a specific S3 bucket. Which IAM role policy follows the least privilege principle?

A{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["s3:PutObject"], "Resource": "arn:aws:s3:::my-app-uploads/*"}]}
B{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["s3:*"], "Resource": "arn:aws:s3:::*"}]}
C{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["s3:ListBucket"], "Resource": "arn:aws:s3:::my-app-uploads"}]}
D{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::my-app-uploads/*"}]}
Attempts:
2 left
💡 Hint

Allow only the action needed to upload files and restrict to the specific bucket path.

Architecture
advanced
2:30remaining
Designing a multi-tier app with least privilege access

You have a web app with three tiers: frontend, backend, and database. Which architecture best applies the least privilege principle for AWS IAM roles?

AAssign separate IAM roles: frontend role with no AWS permissions, backend role with DynamoDB read/write, database role with RDS access only.
BAssign one IAM role to all tiers with full access to S3, DynamoDB, and RDS.
CAssign one IAM role to frontend and backend with full S3 access, and a separate role for database with RDS access.
DAssign backend role with full access to all AWS services, frontend role with read-only S3 access, database role with no permissions.
Attempts:
2 left
💡 Hint

Think about limiting permissions to only what each tier needs.

service_behavior
advanced
2:00remaining
Effect of overly broad IAM permissions on AWS Lambda behavior

You deploy a Lambda function with an IAM role that has full access to all S3 buckets. What is the likely impact compared to a role with access only to one bucket?

AThe Lambda function will only access the specified bucket regardless of permissions.
BThe Lambda function can access all buckets, increasing risk if compromised.
CThe Lambda function will fail to execute due to too many permissions.
DThe Lambda function will run faster with broader permissions.
Attempts:
2 left
💡 Hint

Consider security risks of broad permissions.

🧠 Conceptual
expert
3:00remaining
Identifying violation of least privilege in a cross-account access scenario

An AWS account A grants an IAM role in account B permission to assume it and access all S3 buckets in account A. Which statement best describes the least privilege violation?

AAccount B should not assume any roles in account A to maintain security.
BAccount B should have full access to all resources in account A for flexibility.
CAccount A should allow the role to assume any IAM role in account B.
DAccount A should restrict the role's permissions to only required buckets instead of all buckets.
Attempts:
2 left
💡 Hint

Focus on limiting permissions granted across accounts.