为 IAM 用户创建访问密钥 - Amazon Command Line Interface
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

为 IAM 用户创建访问密钥

本主题介绍如何使用 Amazon Command Line Interface (Amazon CLI) 命令为 Amazon Identity and Access Management (IAM) 用户创建一组访问密钥。有关 IAM 服务的更多信息,请参阅 Amazon Identity and Access Management 用户指南

在运行任何命令之前,请设置默认证书。有关更多信息,请参阅配置Amazon CLI

您可以使用 create-access-key 命令为用户创建访问密钥。访问密钥是一组安全凭证,由访问密钥 ID 和私有密钥组成。

用户一次只能创建两个访问密钥。如果您尝试创建第三组,则命令返回 LimitExceeded 错误。

$ aws iam create-access-key --user-name MyUser { "AccessKey": { "UserName": "MyUser", "AccessKeyId": "AKIAIOSFODNN7EXAMPLE", "Status": "Active", "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "CreateDate": "2018-12-14T17:34:16Z" } }

使用 delete-access-key 命令为用户删除访问密钥。使用访问密钥 ID 指定要删除的访问密钥。

$ aws iam delete-access-key --user-name MyUser --access-key-id AKIAIOSFODNN7EXAMPLE