1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【AWS】ルートユーザー以外でもアカウント名の設定が可能になったので試してみた

Last updated at Posted at 2025-04-25

アカウント名について

アカウント名は、AWSアカウントに付ける別名(ニックネーム)のようなものです。
通常、AWSアカウントは12桁の数字(例:123456789012)で識別されますが、これを覚えるのは面倒で間違いやすいです。
名を設定すると、この数字の代わりにわかりやすい名前を使ってログイン画面や管理コンソールでアカウントを識別できます。

2025/04の変更点

アカウント名の設定は今までルートユーザーのみでしか行えませんでした。
先日、ルートユーザー以外でも設定が可能となる変更があったため、今回はルートユーザーを使用せずに設定を試してみます。
https://aws.amazon.com/jp/about-aws/whats-new/2025/04/aws-account-management-iam-based-name-updates/

環境

スタンドアロン環境
aws-cli/2.27.1

AWSアカウントがスタンドアロンかOrganizationsかで設定方法が変わります。
また、aws-cliのバージョンによってはaccount put-account-nameがない場合があります。

Organizationsの場合の設定変更については今回取り扱わないため以下のAWSドキュメントを参照ください。
https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-update-acct-name.html

必要な権限について

まずは権限として、account:GetAccountInformation,account:PutAccountNameの2つが必要です。
必要に応じてIAMポリシーを作成し、IAMユーザーかIAMロールに割り当てます。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "account:GetAccountInformation",
            "Resource": "arn:aws:account::<アカウントID>:account"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "account:PutAccountName",
            "Resource": "arn:aws:account::<アカウントID>:account"
        }
    ]
}

スタンドアロン設定変更

また、AWSアカウントがスタンドアロンかOrganizationsかで設定方法が変わります。
今回はスタンドアロンのアカウントで設定をします。

aws-cliで以下のコマンドを実施します。

aws account put-account-name --account-name "New-Account-Name"

検証当初、実行した際に以下のエラーとなりました。

~ $ aws account put-account-name --account-name "New-Account-Name"

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument operation: Invalid choice, valid choices are:

accept-primary-email-update              | delete-alternate-contact                
disable-region                           | enable-region                           
get-alternate-contact                    | get-contact-information                 
get-primary-email                        | get-region-opt-status                   
list-regions                             | put-alternate-contact                   
put-contact-information                  | start-primary-email-update              
help                                    

aws account helpで確認したところ、どうやら、put-account-nameがないようです。

AVAILABLE COMMANDS
       o accept-primary-email-update
       o delete-alternate-contact
       o disable-region
       o enable-region
       o get-alternate-contact
       o get-contact-information
       o get-primary-email
       o get-region-opt-status
       o help
       o list-regions
       o put-alternate-contact
       o put-contact-information
       o start-primary-email-update

aws-cliのバージョンを確認したところ、aws-cli/2.26.6だっため検証時最新版のaws-cli/2.27.1にアップデートしたところ、無事にコマンドが通り、変更ができました。

コンソール確認

マネジメントコンソールからアカウントページに移動し、アカウント名が変更できたことを確認できます。

もしくは、aws-cliを使用せずに、マネジメントコンソール上でも変更可能です。
その場合は、アカウントページから[アカウントの詳細]-[アクション]-[アカウント名の更新]から変更可能です。

まとめ

以上、アカウント名の変更についてでした。
今までルートユーザーでしか行えない作業の1つであったアカウント名の設定がルートユーザーでログインせずに変更できるようになりました。

アカウント名の使用箇所は主にAWSへのログイン時とマネジメントコンソールへのURLの部分になります。

ルートユーザー以外で変更できることへの懸念はあまり思いつきませんが、IAMの権限さえあればルートユーザー以外でもアカウント名の設定、変更が可能になったことは認識しておいたほうがよさそうです。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?