# IAM policy example: change your own password and keys, with a least privilege rewrite

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

Allows an IAM user to change their own password, create and delete their own access keys, and read their own user details. The resource is the caller's own user ARN through the aws:username variable. The original grants the same actions on every user.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "OwnCredentials",
      "Effect": "Allow",
      "Action": [
        "iam:ChangePassword",
        "iam:CreateAccessKey",
        "iam:DeleteAccessKey",
        "iam:ListAccessKeys",
        "iam:UpdateAccessKey",
        "iam:GetUser"
      ],
      "Resource": "arn:aws:iam::111122223333:user/*"
    }
  ]
}
```

## What it allows

- Allows password changes and access key management on every IAM user in the account.

- Allows 6 actions (iam:ChangePassword, iam:CreateAccessKey, iam:DeleteAccessKey, iam:ListAccessKeys, iam:UpdateAccessKey, iam:GetUser) on arn:aws:iam::111122223333:user/*.

Checks:
- No flags.

The user resource is a wildcard, so any user can create an access key for an administrator.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "OwnCredentials",
      "Effect": "Allow",
      "Action": [
        "iam:ChangePassword",
        "iam:CreateAccessKey",
        "iam:DeleteAccessKey",
        "iam:ListAccessKeys",
        "iam:UpdateAccessKey",
        "iam:GetUser"
      ],
      "Resource": "arn:aws:iam::111122223333:user/${aws:username}"
    },
    {
      "Sid": "PasswordPolicy",
      "Effect": "Allow",
      "Action": "iam:GetAccountPasswordPolicy",
      "Resource": "*"
    }
  ]
}
```

The rewrite replaces the wildcard with the caller's own user ARN and adds the password policy read the console change-password page uses.

- Allows 6 actions (iam:ChangePassword, iam:CreateAccessKey, iam:DeleteAccessKey, iam:ListAccessKeys, iam:UpdateAccessKey, iam:GetUser) on arn:aws:iam::111122223333:user/${aws:username}.
- Allows 1 action (iam:GetAccountPasswordPolicy) on every resource.

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every IAM action and its access level](/actions/iam/)

## Related pages

- [IAM policy example: let a user pass one role to Lambda](/examples/iam-pass-one-role-to-lambda/)
- [IAM policy example: let a team create roles under one path](/examples/iam-delegate-role-management-by-path/)
- [IAM policy example: read IAM configuration for an audit](/examples/iam-read-only-audit/)
- [All of them](/examples/)

## Sources

- IAM User Guide: manage your own credentials: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_iam_credentials_console.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/iam-manage-own-credentials/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
