Closed wdower closed 10 months ago
Hi @wdower, thanks for reaching out. This behavior is intended. Per the GetAccountPasswordPolicy
documentation,
If no password policy is defined for the account, the command returns a NoSuchEntity error.
Re :
So it looks like the AWS API thinks that having the default password policy in place is equivalent to having no password policy set at all. This is incorrect.
Using the default password policy is considered having no password policy defined. There isn't a situation where you literally have no password policy, because you have to be using either the default or a custom policy.
Hope that clears things up!
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.
Describe the bug
Using the AWS CLI to query for an account password policy fails if the default policy is set.
Expected Behavior
If the default policy is set, I expect that running
aws iam get-account-password-policy
would return data on that policy:Current Behavior
CLI command:
Examining the AWS console shows that I do in fact have an account password policy:
If I edit the default password policy, like so:
Then suddenly the CLI command works as expected:
So it looks like the AWS API thinks that having the default password policy in place is equivalent to having no password policy set at all. This is incorrect.
Reproduction Steps
1) Enter the AWS console and use an appropriate IAM role to log in and change the account password policy to the default (if not already set), as indicated in the menu: 2) Open a terminal and configure the AWS CLI to use the same IAM role as the one used to set the password policy to the default (if not already set). 3) Run
aws iam get-account-password-policy
. There should be an error message like:Possible Solution
No response
Additional Information/Context
Version of the CLI:
NOTE: I originally saw this issue when using the AWS SDK for Ruby3 (calling GetAccountPasswordPolicy). If the error appears in both the AWS CLI and one of the SDKs, I'd assume that the problem is with the underlying API logic.
CLI version used
2.13.37
Environment details (OS name and version, etc.)
Ubuntu 20