Creating users and user groups in AWS comes under IAM (Identity and Access Management) service, in this article we are going to look at how to create users and user groups using AWS CLI commands.
This article use AWS CLI commands, if you haven't installed AWS CLI, you can follow steps from this
How to create an user using CLI How to setup a password for an user using CLI How to update password for an user using CLI How to delete an user using CLI How to create a group using CLI How to add an user to a group using CLI How to remove an user from a group using CLI How to delete a group using CLI
You can create an user account using
When you run the command, it will produce the result of the execution output in the format that you configured (it is JSON in my case).
As you may have noticed above that we have only created an user account, and this account does not have any password. This user can access AWS resources using assumed roles, access keys, SSH keys or server certificates for some AWS services.
If you have a need to setup a password for this user,
you can use
When you run the above command, if it is successful, then it shows output like this.
-
If you are a administrator and would like to change other user(s) passwords,
you can run
aws iam update-login-profile with--user-name and--password . -
If you want to change your own password (user currently logged in CLI),
you can use
aws iam change-password command with parameters--old-password and--new-password .
If you want to enforce the user reset the password upon next login,
you can pass
You can delete an user account using
You can create a group using
In the above command, we are creating a group with the name testgroup, once the command is run and if it success, it will produce out like this.
Once the group is created and if you want to add users to this group,
you can run
You can remove an user from a group using
You can remove an user from a group using