Skip to content

14._IAM

Ahmad Abdo edited this page Jun 26, 2017 · 1 revision

IAM

listIAMInstanceProfiles


Usage

$ awsm listIAMInstanceProfiles --help
NAME:
   awsm listIAMInstanceProfiles - List IAM Instance Profiles

USAGE:
   awsm listIAMInstanceProfiles [arguments...]

ARGUMENTS:
   [search] - The keyword to search for


Example Output

awsm listIAMInstanceProfiles

This will list all IAM Instance Profiles, the output should look similar to this:

$ awsm listIAMInstanceProfiles
+-------------------------------+-----------------------+--------------+--------------------------------------------------------------------------+
|         PROFILE NAME          |      PROFILE ID       |   CREATED    |                                   ARN                                    |
+-------------------------------+-----------------------+--------------+--------------------------------------------------------------------------+
| aws-elasticbeanstalk-ec2-role | AIPAJJB577XTPFQXTQ6LA | 4 years ago  | arn:aws:iam::971042242642:instance-profile/aws-elasticbeanstalk-ec2-role |
| aws-opsworks-ec2-role         | AIPAIRT6U2IEFKFDOULTQ | 4 years ago  | arn:aws:iam::971042242642:instance-profile/aws-opsworks-ec2-role         |
| awsm                          | AIPAJQX4SJ6LRLERUFR6U | 4 months ago | arn:aws:iam::971042242642:instance-profile/awsm                          |
| Flow-Logs-Role                | AIPAJK6K7KVTKT3RG3CS6 | 9 months ago | arn:aws:iam::971042242642:instance-profile/Flow-Logs-Role                |
+-------------------------------+-----------------------+--------------+--------------------------------------------------------------------------+



listIAMPolicies


Usage

$ awsm listIAMPolicies --help
NAME:
   awsm listIAMPolicies - List IAM Policies

USAGE:
   awsm listIAMPolicies [arguments...]

ARGUMENTS:
   [search] - The keyword to search for


Example Output

awsm listIAMPolicies

This will list all IAM Policies, the output should look similar to this:

$ awsm listIAMPolicies
+------------------------------------------------+-----------------------+-------------+------------+------------------+---------------+---------+
|                  POLICY NAME                   |       POLICY ID       | DESCRIPTION | ATTACHABLE | ATTACHMENT COUNT |    CREATED    | VERSION |
+------------------------------------------------+-----------------------+-------------+------------+------------------+---------------+---------+
| awsm-db                                        | ANPAJ2VGQWI2EK7EAPOJY |             | true       |                1 | 4 months ago  | v1      |
| AmazonGlacierReadOnlyAccess                    | ANPAI2D5NJKMU274MET4E |             | true       |                0 | 2 years ago   | v2      |
| AWSMarketplaceFullAccess                       | ANPAI2DV5ULJSO2FYVPYG |             | true       |                0 | 2 years ago   | v1      |
| AutoScalingConsoleReadOnlyAccess               | ANPAI3A7GDXOYQV3VUQMK |             | true       |                0 | 4 months ago  | v1      |
| AmazonDMSRedshiftS3Role                        | ANPAI3CCUQ4U5WNC5F6B6 |             | true       |                0 | 1 year ago    | v1      |
| AmazonEC2FullAccess                            | ANPAI3VAJF5ZCRZ7MCQE6 |             | true       |                1 | 2 years ago   | v1      |
| AmazonAthenaFullAccess                         | ANPAIPJMLMD4C7RYZ6XCK |             | true       |                0 | 6 months ago  | v1      |
| AWSCloudTrailFullAccess                        | ANPAIQNUJTQYDRJPC3BNK |             | true       |                0 | 2 years ago   | v4      |
+------------------------------------------------+-----------------------+-------------+------------+------------------+---------------+---------+



listIAMRoles


Usage

$ awsm listIAMRoles --help
NAME:
   awsm listIAMRoles - List IAM Roles

USAGE:
   awsm listIAMRoles [arguments...]

ARGUMENTS:
   [search] - The keyword to search for

Example Output

awsm listIAMRoles

This will list all IAM Roles, the output should look similar to this:

$ awsm listIAMRoles
+-------------------------------+-----------------------+---------------+--------------------------------------------------------------+
|           ROLE NAME           |        ROLE ID        |    CREATED    |                             ARN                              |
+-------------------------------+-----------------------+---------------+--------------------------------------------------------------+
| aws-elasticbeanstalk-ec2-role | AROAJVS2B4JLGBJXQ2TNC | 4 years ago   | arn:aws:iam::971042242642:role/aws-elasticbeanstalk-ec2-role |
| aws-opsworks-ec2-role         | AROAIYTQEGX7SFKXSUWC2 | 4 years ago   | arn:aws:iam::971042242642:role/aws-opsworks-ec2-role         |
| aws-opsworks-service-role     | AROAIR7PNKJTLCP5ZGS4C | 4 years ago   | arn:aws:iam::971042242642:role/aws-opsworks-service-role     |
| awsm                          | AROAIXDR5BJOVSHSA4ISQ | 4 months ago  | arn:aws:iam::971042242642:role/awsm                          |
| Flow-Logs-Role                | AROAIUMDNB7Z7OCONUTFQ | 9 months ago  | arn:aws:iam::971042242642:role/Flow-Logs-Role                |
| rds-monitoring-role           | AROAIVSFQQ3AGK3KQRFCA | 11 months ago | arn:aws:iam::971042242642:role/rds-monitoring-role           |
+-------------------------------+-----------------------+---------------+--------------------------------------------------------------+



listIAMUsers


Usage

$ awsm listIAMUsers --help
NAME:
   awsm listIAMUsers - List IAM Users

USAGE:
   awsm listIAMUsers [arguments...]

ARGUMENTS:
   [search] - The keyword to search for


Example Output

awsm listIAMUsers

This will list all IAM Users, the output should look similar to this:

$ awsm listIAMUsers
+-------------------------------+-----------------------+--------------+--------------------------------------------------------------+------------------+
|           USER NAME           |        USER ID        |   CREATED    |                             ARN                              |    LAST USED     |
+-------------------------------+-----------------------+--------------+--------------------------------------------------------------+------------------+
| awsm                          | AIAAJEDFS2SKLKNJL2OCY | 7 months ago | arn:aws:iam::975342247642:user/awsm                          | a long while ago |
| ses-smtp-user                 | AIDDIKEEYFS62CYHQEKED | 4 years ago  | arn:aws:iam::475449222342:user/ses-smtp-user                 | a long while ago |
+-------------------------------+-----------------------+--------------+--------------------------------------------------------------+------------------+



createIAMUser


Usage

$ awsm createIAMUser --help
Incorrect Usage.

NAME:
   awsm createIAMUser - Create an IAM User

USAGE:
   awsm createIAMUser [arguments...]

ARGUMENTS:
   username - The username for this IAM user
   [path] - The optional path for the user

Example Output

awsm createIAMUser example-user

This will create an IAM User named example-user, the output should look similar to this:

$ awsm createIAMUser example-user

△  Created IAM User [example-user] with User ID [AIDAIVS53EBSBB4TNT2TO]                                

✓  Done!      



createIAMPolicy


Usage

$ awsm createIAMPolicy --help

NAME:
   awsm createIAMPolicy - Create an IAM Policy

USAGE:
   awsm createIAMPolicy [arguments...]

ARGUMENTS:
   name - The name for this IAM policy
   document - The document file for this IAM policy
   [path] - The optional path for this IAM policy
   [description] - The optional description for this IAM policy

Example Output

awsm createIAMPolicy example-iam-policy ~/Desktop/example-iam-policy

This will create an IAM Policy named example-iam-policy with the contents of the file located at ~/Desktop/example-iam-policy, the output should look similar to this:

$ awsm createIAMPolicy example-iam-policy ~/Desktop/example-iam-policy

△  Created IAM Policy named [example-iam-policy] with ARN [arn:aws:iam::971042242642:policy/example-iam-policy] 



attachIAMRolePolicy


Usage

$ awsm attachIAMRolePolicy --help

NAME:
   awsm attachIAMRolePolicy - Attach an IAM Policy to a IAM Role

USAGE:
   awsm attachIAMRolePolicy [arguments...]

ARGUMENTS:
   role - The name of the role to attach the policy to
   policy - The name of the policy to attach to the role

Example Output

awsm attachIAMRolePolicy awsm Billing

This will attach the Billing IAM Policy to the awsm IAM Role, the output should look similar to this:

$ awsm attachIAMRolePolicy awsm Billing

▶  Role:                                                                                               
+-----------+-----------------------+--------------+-------------------------------------+
| ROLE NAME |        ROLE ID        |   CREATED    |                 ARN                 |
+-----------+-----------------------+--------------+-------------------------------------+
| awsm      | AROAIXDR5BJOVSHSA4ISQ | 5 months ago | arn:aws:iam::971042242642:role/awsm |
+-----------+-----------------------+--------------+-------------------------------------+

▶  Policies:                                                                                           
+-------------+-----------------------+-------------+------------+------------------+--------------+---------+
| POLICY NAME |       POLICY ID       | DESCRIPTION | ATTACHABLE | ATTACHMENT COUNT |   CREATED    | VERSION |
+-------------+-----------------------+-------------+------------+------------------+--------------+---------+
| Billing     | ANPAIFTHXT6FFMIRT7ZEA |             | true       |                1 | 7 months ago | v1      |
+-------------+-----------------------+-------------+------------+------------------+--------------+---------+

▶  Are you sure you want to attach these policies to this IAM Role?                                    
◀  y

✓  Done!



getIAMInstanceProfile


Usage

$ awsm getIAMInstanceProfile --help

NAME:
   awsm getIAMInstanceProfile - Get an IAM Instance Profile

USAGE:
   awsm getIAMInstanceProfile [arguments...]

ARGUMENTS:
   search - The search term for the iam instance profile

Example Output

awsm getIAMInstanceProfile awsm

This will retrieve the IAM Instance Profile matching the name awsm, the output should look similar to this:

$ awsm getIAMInstanceProfile awsm
+--------------+-----------------------+--------------+-------------------------------------------------+
| PROFILE NAME |      PROFILE ID       |   CREATED    |                       ARN                       |
+--------------+-----------------------+--------------+-------------------------------------------------+
| awsm         | AIPAJQX4SJ6LRLERUFR6U | 5 months ago | arn:aws:iam::971042242642:instance-profile/awsm |
+--------------+-----------------------+--------------+-------------------------------------------------+



getIAMPolicy


Usage

$ awsm getIAMPolicy --help
Incorrect Usage.

NAME:
   awsm getIAMPolicy - Get an IAM Policy

USAGE:
   awsm getIAMPolicy [arguments...]

ARGUMENTS:
   search - The search term for the iam policy document
   [version] - The version of the iam policy document to retrieve

Example Output

awsm getIAMPolicy Billing

This will retrieve the IAM Policy matching the name Billing, the output should look similar to this:

$ awsm getIAMPolicy Billing
{
	"Version": "2012-10-17",
	"Statement": [{
		"Effect": "Allow",
		"Action": [
			"aws-portal:*Billing",
			"aws-portal:*Usage",
			"aws-portal:*PaymentMethods",
			"budgets:ViewBudget",
			"budgets:ModifyBudget"
		],
		"Resource": "*"
	}]

}



getIAMUser


Usage

$ awsm getIAMUser --help
NAME:
   awsm getIAMUser - Get an IAM User

USAGE:
   awsm getIAMUser [arguments...]

ARGUMENTS:
   [search] - The username to search for

Example Output

awsm getIAMUser example-user

This will get a single IAM User matching the name example-user, the output should look similar to this:

$ awsm getIAMUser example-user
+--------------+-----------------------+------------+---------------------------------------------+------------------+
|  USER NAME   |        USER ID        |  CREATED   |                     ARN                     |    LAST USED     |
+--------------+-----------------------+------------+---------------------------------------------+------------------+
| example-user | AIDAIVS53EBSBB4TNT2TO | 2 days ago | arn:aws:iam::971042242642:user/example-user | a long while ago |
+--------------+-----------------------+------------+---------------------------------------------+------------------+



deleteIAMInstanceProfiles


Usage

$ awsm deleteIAMInstanceProfiles --help

NAME:
   awsm deleteIAMInstanceProfiles - Delete IAM Instance Profiles

USAGE:
   awsm deleteIAMInstanceProfiles [arguments...]

ARGUMENTS:
   search - The search term for iam instance profiles

Example Output

awsm deleteIAMInstanceProfiles awsm

This will delete IAM Instance Profiles matching the name awsm, the output should look similar to this:

$ awsm deleteIAMInstanceProfiles awsm

+--------------+-----------------------+--------------+-------------------------------------------------+
| PROFILE NAME |      PROFILE ID       |   CREATED    |                       ARN                       |
+--------------+-----------------------+--------------+-------------------------------------------------+
| awsm         | AIPAJQX4SJ6LRLERUFR6U | 5 months ago | arn:aws:iam::971042242642:instance-profile/awsm |
+--------------+-----------------------+--------------+-------------------------------------------------+

▶  Are you sure you want to delete these IAM Instance Profiles?                                        
◀  y

✓  Done! 



deleteIAMPolicies


Usage

$ awsm deleteIAMPolicies --help

NAME:
   awsm deleteIAMPolicies - Delete IAM Policies

USAGE:
   awsm deleteIAMPolicies [arguments...]

ARGUMENTS:
   search - The search term for iam policy

Example Output

awsm deleteIAMPolicies example-iam-policy

This will delete IAM Policies matching the term example-iam-policy, the output should look similar to this:

$ awsm deleteIAMPolicies example-iam-policy
+--------------------+-----------------------+-------------+------------+------------------+------------+---------+
|    POLICY NAME     |       POLICY ID       | DESCRIPTION | ATTACHABLE | ATTACHMENT COUNT |  CREATED   | VERSION |
+--------------------+-----------------------+-------------+------------+------------------+------------+---------+
| example-iam-policy | ANPAJM3ABR6WOA5JKLWFG |             | true       |                0 | 2 days ago | v1      |
+--------------------+-----------------------+-------------+------------+------------------+------------+---------+

▶  Are you sure you want to delete these IAM Policies?                                                 
◀  y

△  Deleted IAM Policy [example-iam-policy]!                                                            

✓  Done!



deleteIAMRoles


Usage

$ awsm deleteIAMRoles --help

NAME:
   awsm deleteIAMRoles - Delete IAM Roles

USAGE:
   awsm deleteIAMRoles [arguments...]

ARGUMENTS:
   search - The search term for iam role

Example Output

awsm deleteIAMRoles awsm

This will delete IAM Roles matching the term awsm, the output should look similar to this:

$ awsm deleteIAMRoles awsm

+-----------+-----------------------+--------------+-------------------------------------+
| ROLE NAME |        ROLE ID        |   CREATED    |                 ARN                 |
+-----------+-----------------------+--------------+-------------------------------------+
| awsm      | AROAIXDR5BJOVSHSA4ISQ | 5 months ago | arn:aws:iam::971042242642:role/awsm |
+-----------+-----------------------+--------------+-------------------------------------+

▶  Are you sure you want to delete these IAM Roles?                                                    
◀  y

✓  Done!



deleteIAMUsers


Usage

$ awsm deleteIAMUsers --help

NAME:
   awsm deleteIAMUsers - Delete IAM Users

USAGE:
   awsm deleteIAMUsers [arguments...]

ARGUMENTS:
   search - The search term for iam username

Example Output

awsm deleteIAMUsers example-user

This will delete IAM Users matching the term example-user, the output should look similar to this:

$ awsm deleteIAMUsers example-user
+--------------+-----------------------+------------+---------------------------------------------+------------------+
|  USER NAME   |        USER ID        |  CREATED   |                     ARN                     |    LAST USED     |
+--------------+-----------------------+------------+---------------------------------------------+------------------+
| example-user | AIDAIVS53EBSBB4TNT2TO | 3 days ago | arn:aws:iam::971042242642:user/example-user | a long while ago |
+--------------+-----------------------+------------+---------------------------------------------+------------------+

▶  Are you sure you want to delete these IAM Users?                                                    
◀  y

△  Deleted IAM User [example-user]!                                                                    

✓  Done!