A developer is configuring an IAM role for an AWS Lambda function that needs to write items to an Amazon DynamoDB table and publish messages to an Amazon SNS topic. The security team requires least-privilege access. Which combination of actions should be included in the IAM policy attached to the Lambda execution role? (Select TWO)
- A. iam:PassRole on the Lambda function's execution role ARN
- B. dynamodb:PutItem on the specific DynamoDB table ARN✓ Correct
- C. sns:* on arn:aws:sns:::*
- D. sns:Publish on the specific SNS topic ARN✓ Correct
- E. dynamodb:* on arn:aws:dynamodb:::*
Explanation
Least-privilege means granting only the specific actions needed on the specific resources. dynamodb:PutItem on the exact table ARN grants only the write permission needed for DynamoDB. sns:Publish on the exact topic ARN grants only the publish permission needed for SNS. dynamodb:* on a wildcard ARN is overly permissive, granting all DynamoDB actions across all tables — violating least-privilege. sns:* on a wildcard ARN is similarly over-permissive. iam:PassRole is used when a service needs to pass a role to another AWS service; it is not required for a Lambda function to write to DynamoDB or SNS.