{"id":1530,"date":"2021-05-07T16:08:48","date_gmt":"2021-05-07T07:08:48","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/?p=1530"},"modified":"2021-05-07T16:08:48","modified_gmt":"2021-05-07T07:08:48","slug":"delete-iam-user","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2021\/05\/07\/delete-iam-user\/","title":{"rendered":"AWS SDK\u3092\u7528\u3044\u3066IAM\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"

\u3053\u3093\u306b\u3061\u306f\u3001\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u7267\u7530\u3067\u3059\u3002\u6700\u8fd1\u306f\u7af6\u30d7\u30ed\u306b\u30cf\u30de\u3063\u3066\u3044\u307e\u3059\u3002\u7d042\u30f6\u6708\u524d\u306b\u59cb\u3081\u305fAtCoder\u306e\u30ec\u30fc\u30c8\u304c\u8336\u8272\u306b\u5230\u9054\u3057\u305f\u306e\u3067\u3001\u3053\u308c\u304b\u3089\u3082\u9811\u5f35\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n

\u6982\u8981<\/h2>\n

\u4eca\u56de\u306fAWS SDK\u3092\u7528\u3044\u3066IAM\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002
\n\u76f4\u8fd1\u958b\u767a\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3001\u4e0d\u8981\u306b\u306a\u3063\u305fIAM\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u51e6\u7406\u3092\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u3002\u305d\u306e\u6642\u306e\u5b9f\u88c5\u304c\u5c11\u3057\u9762\u5012\u3060\u3063\u305f\u306e\u3067\u3001\u5fc5\u8981\u306a\u624b\u9806\u3092\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\u4f55\u304c\u9762\u5012\u306a\u306e\u304b<\/h2>\n

AWS SDK\u306b\u3042\u308bDeleteUser<\/code>\u3068\u3044\u3046\u95a2\u6570\u3092\u7528\u3044\u308b\u3068\u3001\u7279\u5b9a\u306e\u540d\u524d\u306eIAM\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002
\n\u3057\u304b\u3057\u3001\u30de\u30cd\u30b8\u30e1\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u7d4c\u7531\u3067\u524a\u9664\u3059\u308b\u5834\u5408\u306f\u30e6\u30fc\u30b6\u30fc\u306b\u7d10\u3065\u3044\u3066\u3044\u308b\u60c5\u5831\u304c\u81ea\u52d5\u7684\u306b\u524a\u9664\u3055\u308c\u308b\u306e\u3067\u3059\u304c\u3001CLI\u3084SDK\u7d4c\u7531\u3067\u524a\u9664\u3059\u308b\u5834\u5408\u306f\u3001\u305d\u308c\u3089\u306e\u60c5\u5831\u3092\u4e8b\u524d\u306b\u524a\u9664\u3057\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n

\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u7167\u3059\u308b\u3068\u3001\u4e8b\u524d\u306b\u524a\u9664\u3059\u3079\u304d\u9805\u76ee\u306f\u4ee5\u4e0b\u306e9\u3064\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002
\nhttps:\/\/docs.aws.amazon.com\/IAM\/latest\/APIReference\/API_DeleteUser.html<\/a><\/p>\n

\n

Deletes the specified IAM user. Unlike the AWS Management Console, when you delete a user programmatically, you must delete the items attached to the user manually, or the deletion fails. For more information, see\u00a0Deleting an IAM user. Before attempting to delete a user, remove the following items:<\/p>\n

    \n
  • Password (DeleteLoginProfile)<\/li>\n
  • Access keys (DeleteAccessKey)<\/li>\n
  • Signing certificate (DeleteSigningCertificate)<\/li>\n
  • SSH public key (DeleteSSHPublicKey)<\/li>\n
  • Git credentials (DeleteServiceSpecificCredential)<\/li>\n
  • Multi-factor authentication (MFA) device (DeactivateMFADevice,\u00a0DeleteVirtualMFADevice)<\/li>\n
  • Inline policies (DeleteUserPolicy)<\/li>\n
  • Attached managed policies (DetachUserPolicy)<\/li>\n
  • Group memberships (RemoveUserFromGroup)\u2028<\/li>\n<\/ul>\n<\/blockquote>\n

    \u5404\u9805\u76ee\u306b\u3064\u3044\u3066<\/h3>\n

    \u4e8b\u524d\u306b\u524a\u9664\u3059\u3079\u304d\u5404\u9805\u76ee\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n

    Password<\/h4>\n

    \u30d1\u30b9\u30ef\u30fc\u30c9\u3002\u30b3\u30f3\u30bd\u30fc\u30eb\u7d4c\u7531\u3067AWS\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u304d\u306b\u5fc5\u8981\u306a\u3082\u306e\u3067\u3059\u3002
    \nDeleteLoginProfile<\/code>\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    Access keys<\/h4>\n

    \u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u3002CLI\u7b49\u7d4c\u7531\u3067AWS\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u304d\u306b\u5fc5\u8981\u306a\u3082\u306e\u3067\u3059\u3002
    \nDeleteAccessKey<\/code>\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    Signing certificate<\/h4>\n

    \u7f72\u540d\u8a3c\u660e\u66f8\u3002<\/p>\n

    \n

    \u7279\u5b9a\u306eAWS\u88fd\u54c1\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3078\u306e\u30bb\u30ad\u30e5\u30a2\u306a\u30a2\u30af\u30bb\u30b9\u306b\u3001\u30c7\u30b8\u30bf\u30eb\u7f72\u540d\u7528\u8a3c\u660e\u66f8\uff08X.509 \u8a3c\u660e\u66f8\uff09\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<\/blockquote>\n

    DeleteSigningCertificate<\/code>\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    SSH public key<\/h4>\n

    SSH \u30d1\u30d6\u30ea\u30c3\u30af\u30ad\u30fc\u3002CodeCommit\u306bSSH\u63a5\u7d9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u3082\u306e\u3067\u3059\u3002
    \nDeleteSSHPublicKey<\/code>\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    Git credentials<\/h4>\n

    Git \u8a8d\u8a3c\u60c5\u5831\u3002CodeCommit\u306bHTTPS\u63a5\u7d9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u3082\u306e\u3067\u3059\u3002
    \nDeleteServiceSpecificCredential<\/code>\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    Multi-factor authentication (MFA) device<\/h4>\n

    MFA(\u591a\u8981\u7d20\u8a8d\u8a3c)\u30c7\u30d0\u30a4\u30b9\u3002AWS \u306b\u30b5\u30a4\u30f3\u30a4\u30f3\u3059\u308b\u969b\u306eMFA\u3092\u8a2d\u5b9a\u3059\u308b\u3082\u306e\u3067\u3059\u3002
    \n\u4eee\u60f3\u30c7\u30d0\u30a4\u30b9\uff08Authy\u306a\u3069\uff09\u3092\u7528\u3044\u3066\u3044\u308b\u5834\u5408\u306f\u3001DeactivateMFADevice<\/code>\u3067\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u5316\u3057\u305f\u5f8c\u3001DeleteVirtualMFADevice<\/code>\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    Inline policies<\/h4>\n

    \u30e6\u30fc\u30b6\u30fc\u306e\u30a4\u30f3\u30e9\u30a4\u30f3\u30dd\u30ea\u30b7\u30fc\u3002
    \nDeleteUserPolicy<\/code>\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    Attached managed policies<\/h4>\n

    \u30e6\u30fc\u30b6\u30fc\u306b\u30a2\u30bf\u30c3\u30c1\u3055\u308c\u305f\u7ba1\u7406\u30dd\u30ea\u30b7\u30fc\u3002
    \nDetachUserPolicy<\/code>\u3067\u30c7\u30bf\u30c3\u30c1\u3057\u307e\u3059\u3002<\/p>\n

    Group memberships<\/h4>\n

    \u30e6\u30fc\u30b6\u30fc\u304c\u6240\u5c5e\u3057\u3066\u3044\u308bIAM\u30b0\u30eb\u30fc\u30d7\u3002
    \nRemoveUserFromGroup<\/code>\u3067\u30b0\u30eb\u30fc\u30d7\u304b\u3089\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n

    \u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\uff08Go\uff09<\/h2>\n