Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use GetGroup
with an Amazon SDK or command line tool
The following code examples show how to use GetGroup
.
- CLI
-
- Amazon CLI
-
To get an IAM group
This example returns details about the IAM group Admins
.
aws iam get-group \
--group-name Admins
Output:
{
"Group": {
"Path": "/",
"CreateDate": "2015-06-16T19:41:48Z",
"GroupId": "AIDGPMS9RO4H3FEXAMPLE",
"Arn": "arn:aws:iam::123456789012:group/Admins",
"GroupName": "Admins"
},
"Users": []
}
For more information, see IAM Identities (users, user groups, and roles) in the Amazon IAM User Guide.
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example returns details about the IAM group Testers
, including a collection of all the IAM users that belong to the group.
$results = Get-IAMGroup -GroupName "Testers"
$results
Output:
Group IsTruncated Marker Users
----- ----------- ------ -----
Amazon.IdentityManagement.Model.Group False {Theresa, David}
$results.Group
Output:
Arn : arn:aws:iam::123456789012:group/Testers
CreateDate : 12/10/2014 3:39:11 PM
GroupId : 3RHNZZGQJ7QHMAEXAMPLE1
GroupName : Testers
Path : /
$results.Users
Output:
Arn : arn:aws:iam::123456789012:user/Theresa
CreateDate : 12/10/2014 3:39:27 PM
PasswordLastUsed : 1/1/0001 12:00:00 AM
Path : /
UserId : 4OSVDDJJTF4XEEXAMPLE2
UserName : Theresa
Arn : arn:aws:iam::123456789012:user/David
CreateDate : 12/10/2014 3:39:27 PM
PasswordLastUsed : 3/19/2015 8:44:04 AM
Path : /
UserId : Y4FKWQCXTA52QEXAMPLE3
UserName : David
For a complete list of Amazon SDK developer guides and code examples, see
Using IAM with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.