There are more AWS SDK examples available in the AWS Doc SDK Examples
Use ListGroupPolicies with a CLI
The following code examples show how to use ListGroupPolicies.
- CLI
-
- AWS CLI
-
To list all inline policies that are attached to the specified group
The following
list-group-policiescommand lists the names of inline policies that are attached to the IAM group namedAdminsin the current account.aws iam list-group-policies \ --group-nameAdminsOutput:
{ "PolicyNames": [ "AdminRoot", "ExamplePolicy" ] }For more information, see Managing IAM policies in the AWS IAM User Guide.
-
For API details, see ListGroupPolicies
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example returns a list of the inline policies that are embedded in the group
Testers. To get the managed policies that are attached to the group, use the commandGet-IAMAttachedGroupPolicyList.Get-IAMGroupPolicyList -GroupName TestersOutput:
Deny-Assume-S3-Role-In-Production PowerUserAccess-Testers-
For API details, see ListGroupPolicies in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example returns a list of the inline policies that are embedded in the group
Testers. To get the managed policies that are attached to the group, use the commandGet-IAMAttachedGroupPolicyList.Get-IAMGroupPolicyList -GroupName TestersOutput:
Deny-Assume-S3-Role-In-Production PowerUserAccess-Testers-
For API details, see ListGroupPolicies in AWS Tools for PowerShell Cmdlet Reference (V5).
-