aws-iam-policy-version
Retrieves IAM customer-managed policy default version documents and wildcard usage.
Syntax
Options
- profile=STRING
- Optional option. The identifier of AWS connect profile When omitted, every AWS connect profile the user may use is queried.
- policy-arn=STRING
- Optional option. Target policy ARN; all local policies if omitted
Output fields
| Field | Type | Name | Description |
|---|---|---|---|
| aws_profile | string | Connect profile | AWS connect profile identifier |
| policy_arn | string | Policy ARN | |
| policy_name | string | Policy name | |
| version_id | string | Version ID | default version ID |
| document | string | Document | URL-decoded policy document JSON |
| has_wildcard_action | bool | Has wildcard action | true = Action "*" present |
| has_wildcard_resource | bool | Has wildcard resource | true = Resource "*" present |
Error codes
Parse errors
| Error message | Cause | Resolution |
|---|---|---|
| aws-profile-not-found | No AWS connect profile matches the name given in the profile option. | Check the name on Settings > Connect Profiles and specify it again. |
| no-permission | The account running the query is not granted the connect profile. | Ask an administrator to grant the connect profile. |
| use-one-aws-profile | More than one connect profile was given in the profile option. | Specify a single connect profile. |
Description
Retrieves IAM customer-managed policy default version documents and wildcard usage.
The following AWS IAM permissions must be allowed to use this command.
- iam:GetPolicy
- iam:GetPolicyVersion
Examples
Example: Get IAM Policy Version
Situation: A periodic review or an incident investigation needs the result of get iam policy version.
Expected result:
| aws_profile | policy_arn | policy_name | version_id |
|---|---|---|---|
| aws-prod | arn:aws:iam::123456789012:resource/example | example-name | example-id-0123 |
Interpretation: One record is one queried item. Use aws_profile and region to tell which account and region it came from, then narrow the columns with fields and either export the result or use it as the lookup stage of a detection rule.
Example: Narrowing to one account and region
Situation: Limit the scope when several connect profiles and regions exist.
Interpretation: Narrowing the scope cuts both the number of AWS API calls and the response time. Scope every scheduled query this way.