:doc:`IAM <../../iam>` / Client / create_login_profile

********************
create_login_profile
********************



.. py:method:: IAM.Client.create_login_profile(**kwargs)

  

  Creates a password for the specified IAM user. A password allows an IAM user to access Amazon Web Services services through the Amazon Web Services Management Console.

   

  You can use the CLI, the Amazon Web Services API, or the **Users** page in the IAM console to create a password for any IAM user. Use `ChangePassword <https://docs.aws.amazon.com/IAM/latest/APIReference/API_ChangePassword.html>`__ to update your own existing password in the **My Security Credentials** page in the Amazon Web Services Management Console.

   

  For more information about managing passwords, see `Managing passwords <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_ManagingLogins.html>`__ in the *IAM User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateLoginProfile>`_  


  **Request Syntax**
  ::

    response = client.create_login_profile(
        UserName='string',
        Password='string',
        PasswordResetRequired=True|False
    )
    
  :type UserName: string
  :param UserName: 

    The name of the IAM user to create a password for. The user must already exist.

     

    This parameter is optional. If no user name is included, it defaults to the principal making the request. When you make this request with root user credentials, you must use an `AssumeRoot <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html>`__ session to omit the user name.

     

    This parameter allows (through its `regex pattern <http://wikipedia.org/wiki/regex>`__) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

    

  
  :type Password: string
  :param Password: 

    The new password for the user.

     

    This parameter must be omitted when you make the request with an `AssumeRoot <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html>`__ session. It is required in all other cases.

     

    The `regex pattern <http://wikipedia.org/wiki/regex>`__ that is used to validate this parameter is a string of characters. That string can include almost any printable ASCII character from the space ( ``\u0020``) through the end of the ASCII character range ( ``\u00FF``). You can also include the tab ( ``\u0009``), line feed ( ``\u000A``), and carriage return ( ``\u000D``) characters. Any of these characters are valid in a password. However, many tools, such as the Amazon Web Services Management Console, might restrict the ability to type certain characters because they have special meaning within that tool.

    

  
  :type PasswordResetRequired: boolean
  :param PasswordResetRequired: 

    Specifies whether the user is required to set a new password on next sign-in.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'LoginProfile': {
              'UserName': 'string',
              'CreateDate': datetime(2015, 1, 1),
              'PasswordResetRequired': True|False
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 

      Contains the response to a successful `CreateLoginProfile <https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateLoginProfile.html>`__ request.

      
      

      - **LoginProfile** *(dict) --* 

        A structure containing the user name and password create date.

        
        

        - **UserName** *(string) --* 

          The name of the user, which can be used for signing in to the Amazon Web Services Management Console.

          
        

        - **CreateDate** *(datetime) --* 

          The date when the password for the user was created.

          
        

        - **PasswordResetRequired** *(boolean) --* 

          Specifies whether the user is required to set a new password on next sign-in.

          
    
  
  **Exceptions**
  
  *   :py:class:`IAM.Client.exceptions.EntityAlreadyExistsException`

  
  *   :py:class:`IAM.Client.exceptions.NoSuchEntityException`

  
  *   :py:class:`IAM.Client.exceptions.PasswordPolicyViolationException`

  
  *   :py:class:`IAM.Client.exceptions.LimitExceededException`

  
  *   :py:class:`IAM.Client.exceptions.ServiceFailureException`

  

  **Examples**

  The following command changes IAM user Bob's password and sets the flag that required Bob to change the password the next time he signs in.
  ::

    response = client.create_login_profile(
        Password='h]6EszR}vJ*m',
        PasswordResetRequired=True,
        UserName='Bob',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'LoginProfile': {
            'CreateDate': datetime(2015, 3, 10, 20, 55, 40, 1, 69, 0),
            'PasswordResetRequired': True,
            'UserName': 'Bob',
        },
        'ResponseMetadata': {
            '...': '...',
        },
    }

  