百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

aws-rotate-key

> 安全
开源

轻松旋转您的 AWS 访问密钥:key:

385 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

轻松旋转您的 AWS 访问密钥:key:

aws-rotate-key

As a security best practice, AWS recommends that users periodically regenerate their API access keys. This tool simplifies the rotation of access keys defined in your credentials file.

When run, the program will list the current access keys associated with your IAM user, and print the steps it has to perform to rotate them. It will then wait for your confirmation before continuing.

Usage

$ aws-rotate-key --help
Usage of aws-rotate-key:
  -auth-profile string
    	Use a different profile when calling AWS.
  -d	Delete the old key instead of deactivating it.
  -mfa
    	Use MFA.
  -mfa-serial-number string
    	Specify the MFA device to use. (optional)
  -profile string
    	The profile to use. (default "default")
  -version
    	Print version number
  -y	Automatic "yes" to prompts.

Example

…

Install

You can download binaries from the releases section.

You can use Homebrew to install on macOS:

bash
brew install aws-rotate-key

You can install using a PPA on Ubuntu Linux:

bash
sudo add-apt-repository ppa:stefansundin/aws-rotate-key
sudo apt install aws-rotate-key

If you have Go installed then you can download and build the program using:

bash
go install github.com/stefansundin/aws-rotate-key@latest

Setup

Make sure your users have permissions to update their own access keys. The following AWS documentation page explains the required permissions: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_delegate-permissions_examples.html.

The following IAM policy is enough for aws-rotate-key:

json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iam:ListAccessKeys",
                "iam:GetAccessKeyLastUsed",
                "iam:DeleteAccessKey",
                "iam:CreateAccessKey",
                "iam:UpdateAccessKey"
            ],
            "Resource": [
                "arn:aws:iam::AWS_ACCOUNT_ID:user/${aws:username}"
            ]
        }
    ]
}

[!WARNING] Replace AWS_ACCOUNT_ID with your AWS account id.

Require MFA

You can require MFA by adding a Condition clause. Please note that you have to use the -mfa option when running the program.

…

Note that this makes it harder to rotate access keys using aws-cli commands, as it only supports MFA when assuming roles. You will still be able to use the AWS management console.

Contribute

To download and hack on the source code, run:

bash
git clone https://github.com/stefansundin/aws-rotate-key.git
cd aws-rotate-key
go build

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goawsclisecurity-tools

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类安全
定价开源

> 相关工具

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.