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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With