{"id":9824,"library":"iamdata","title":"IAMdata Python Library","description":"IAMdata provides comprehensive AWS IAM data for actions, resources, and conditions, based on official IAM policy documents. It ensures data freshness by checking for updates daily. This library is useful for security tools, policy analysis, and compliance checks, providing a programmatic way to access detailed IAM information.","status":"active","version":"0.1.202604161","language":"en","source_language":"en","source_url":"https://github.com/cloud-copilot/iam-data-python","tags":["aws","iam","security","policy","cloud","compliance"],"install":[{"cmd":"pip install iamdata","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary class for interacting with IAM data.","symbol":"IAMData","correct":"from iamdata import IAMData"}],"quickstart":{"code":"from iamdata import IAMData\n\n# Initialize the IAMData object, which will ensure data is up-to-date\niam_data = IAMData()\n\n# Get details for a specific S3 action\ns3_get_object_data = iam_data.get_action(\"s3\", \"GetObject\")\nif s3_get_object_data:\n    print(f\"S3 GetObject: {s3_get_object_data.get('description')}\")\nelse:\n    print(\"S3 GetObject not found.\")\n\n# Get all actions for the S3 service\ns3_actions = iam_data.get_service_actions(\"s3\")\nif s3_actions:\n    print(f\"Number of S3 actions: {len(s3_actions)}\")\n\n# Get details for an EC2 resource type\nec2_instance_data = iam_data.get_resource_type(\"ec2\", \"instance\")\nif ec2_instance_data:\n    print(f\"EC2 Instance resourceARN: {ec2_instance_data.get('resourceARN')}\")","lang":"python","description":"This quickstart demonstrates how to initialize the `IAMData` client and retrieve information about AWS IAM actions and resource types. The library handles automatic data updates upon initialization."},"warnings":[{"fix":"Pin the exact library version in your `requirements.txt` or `pyproject.toml` (e.g., `iamdata==0.1.202604161`).","message":"The library's versioning (`0.1.YYYYMMDD1`) indicates it's still pre-1.0, and while core API methods are generally stable, minor API changes could occur in new date-stamped versions. Pin exact versions for production use to ensure stability.","severity":"gotcha","affected_versions":"0.1.x"},{"fix":"Design your applications to be resilient to potential changes in IAM data content. Avoid hardcoding assumptions about data structures beyond what is documented in AWS IAM policy references.","message":"IAMdata relies on daily updates of external AWS IAM data. This means the *content* of the returned data (e.g., descriptions, condition keys, ARN patterns) can change over time without a library code update. Logic dependent on specific IAM data values might need periodic review.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure the environment where `IAMData()` is initialized has outbound internet access to download data from GitHub. For air-gapped environments, consider pre-populating the data cache.","message":"The library requires internet access to fetch and update its internal IAM data cache. While subsequent operations can be performed offline with cached data, the initial load and daily updates will fail without connectivity.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Always check if the result of a lookup method is `None` before attempting to access its attributes or dictionary items. For example: `data = iam_data.get_action('s3', 'NonExistentAction'); if data: print(data['description'])`.","cause":"A lookup method (e.g., `get_action`, `get_resource_type`) returned `None` because the requested item was not found, and subsequent code attempted to access properties of this `None` object.","error":"AttributeError: 'NoneType' object has no attribute 'get' (or similar errors when accessing properties)"},{"fix":"Verify your internet connection and ensure that no firewalls or proxy settings are preventing Python from making outbound HTTP/HTTPS requests to `github.com`.","cause":"The library failed to connect to its external data source (GitHub) to download updates, likely due to a lack of internet connectivity, a firewall block, or temporary network issues.","error":"requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) OR URLError: <urlopen error ...>"},{"fix":"Use the `.get()` method with a default value for dictionary-like access (e.g., `item.get('description', 'N/A')`) to prevent `KeyError`. Consult AWS IAM documentation or the `iamdata` object structure for available fields.","cause":"Attempting to access a field within an IAM data object that either does not exist, or its name has changed due to an upstream IAM data update.","error":"KeyError: 'some_field' (when accessing dictionary-like objects returned by the library)"}]}