How to create a login profile and a password for an AWS IAM user with the CLI
To create a password for a user, giving them the ability to access AWS services through the AWS Management Console, you can use the create-login-profile
CLI command.
In the terminal, enter the following to create a login profile for the user named Bob in the current account.
aws iam create-login-profile --user-name Bob
--password SuperSecurePassword1234
--password-reset-required
Output:
{
"LoginProfile": {
"UserName": "Bob",
"CreateDate": "2015-03-10T20:55:40.274Z",
"PasswordResetRequired": true
}
}
The user must exist before you can create the login profile. For more information, see How to create an AWS IAM User with the CLI.
Note: If the new password violates the account password policy, the command returns a PasswordPolicyViolation
error.
The create-login-profile
command accepts additional options:
create-login-profile
--user-name <value> //required
--password <value> //required
--password-reset-required | --no-password-reset-required //optional
--cli-input-json | --cli-input-yaml //optional
--generate-cli-skeleton <value> //optional
--cli-auto-prompt <value> //optional
For more information about the command and the additional options, see create-login-profile in the official AWS CLI Command reference.
Note: For this example to work, you need to install and configure the AWS CLI first.