Saturday, 8 April 2017

Useful AWS commands

  • aws iam list-users
    • Gets a list of users in the AWS account. Returns full details of the user object.
  • aws iam list-users --query Users[*].UserName
    • Gets a list of user names in the account.
  • aws iam list-policies 
    • Returns a full list of of AWS policies which includes AWS managed and customer defined.
  • aws iam get-account-password-policy
    • Returns the password policy of the account. If none defined, returns "NoSuchEntity" error.
  • aws iam get-account-summary
    • Returns the limits of the account. Useful to find out what the limits and request increase from AWS support.
  • aws iam list-policies --only-attached
    • Returns a list of policies that are attached. Useful to find out what policies are being used.
  • aws iam list-policies --only-attached --scope Local
    • Gets a list of policies that are managed by the customer that are attached (ignoring AWS managed ones). Useful to detect how many customer defined policies are being used.
  • aws iam list-entities-for-policy --policy-arn "ARN"
    • Lists the users, groups, roles and resources that are using the given policy. 
  • aws ec2 describe-regions
    • Returns a list of regions available. In order for this command to work the "region" in the CLI. If the "region" is not specified we can use "aws configure" to configure a region.

1 comment: