Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refer AWS Account number inside IAM policy

For the sake of the automation, I want my IAM policies to be generic.

I am aware that ${aws:username} fetches username of the policy to whom it is applied to.

Is it possible to do the same for AWS Account number arn:aws:iam::1234567890:user/${aws:username} with something like this arn:aws:iam::${aws:accountnumber}:user/${aws:username} inside an IAM policy.

Edited: Allowed variables are listed in the document linked below. https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html

like image 587
lft93ryt Avatar asked Mar 06 '23 06:03

lft93ryt


1 Answers

AWS IAM Policy Variables does not allow references for AWS Account Names. Hence there is no alternative to dynamically refer the account number in the IAM policy.

like image 136
lft93ryt Avatar answered Mar 19 '23 15:03

lft93ryt