#229·boto3

IAM policy documentation wrong about return type

Author: wtCreated Aug 28, 2015Updated Aug 31, 2026
Labelsbugdocumentationiamp2

Here's one example of the error:

http://boto3.readthedocs.org/en/latest/reference/services/iam.html#IAM.RolePolicy.policy_document

The documentation says a string is returned. Actually, a dict is returned. It's okay to have a dict created from the json, I guess. However, I also cannot use that dict directly with the following API:

http://boto3.readthedocs.org/en/latest/reference/services/iam.html#IAM.RolePolicy.put

I have to wrap the dict with json.dumps() to get it to be the string that the put() method wants for the PolicyDocument arg.

This is confusing, and it would be nice if I could just pass the dict or if the return of the policy_document attribute were actually a string.