Kloudle Logo
ACADEMY

How to change the password of an IAM User using AWS CLI

By Riyaz Walikar 2 min read intermediate level

Introduction

Password rotation is a healthy security behaviour as it ensures that any passwords that may have been leaked, either due to a reuse, or breach, or inadvertently by the user, become irrelevant. The AWS CIS Foundations Benchmark also flags an IAM user whose password has not been changed in the last 90 days as non-compliant. It is recommended to change your password periodically and never reuse it on another site or service.

AWS allows to manage passwords for the users. In this article we will go through the steps to change the password for an IAM user using AWS CLI.

Change password for an IAM user using AWS CLI

Following are the steps to change the password for an IAM user via AWS CLI:

  1. To reset the password for an IAM user, run following command

    aws iam update-login-profile --user-name <IAM_user_name> --password <user_password> --password-reset-required

    Update User Password

    The parameter --password-reset-required can be provided when we are providing a temporary password for a user and require them to set a new password during their next sign-in. If we want to set the actual new password for the user, we can either skip the parameter or use the parameter --no-password-reset-required.

Riyaz Walikar Founder & Chief of R&D

Riyaz Walikar

Founder & Chief of R&D

Riyaz is the founder and Chief of R&D at Kloudle, where he hunts for cloud misconfigurations so developers don’t have to. With over 15 years of experience breaking into systems, he’s led offensive security at PwC and product security across APAC for Citrix. Riyaz created the Kubernetes security testing methodology at Appsecco, blending frameworks like MITRE ATT&CK, OWASP, and PTES. He’s passionate about teaching people how to hack—and how to stay secure.