LoginSignup
13
10

More than 5 years have passed since last update.

何度も忘れちゃうAWSアカウントIDをawscliで確認する方法

Last updated at Posted at 2016-06-22

アカウントIDって覚えてないですよね・・・確認のためにManagement Consoleへアクセスするのはダルい。
ましてやMFA有効にしてたら余計に・・・

毎回ググッてしまうこのコマンドを忘れないように書いておきます。

$ aws sts get-caller-identity

{
    "UserId": "xxxxxxxxxxxxxxx",
    "Arn": "arn:aws:iam::012345678901:user/test",
    "Account": "012345678901"
}

そして、またググッてこの記事がヒットすることを祈る。

update 2017/12/20

awscli-aliasesというものを使うともっとシンプルになります!

$ aws whoami
{
    "UserId": "xxxxxxx",
    "Account": "xxxxxxx",
    "Arn": "arn:aws:iam::xxxxxx:user/foo"
}

profileにも対応してます。

$ aws whoami --profile demo
{
    "UserId": "xxxxxxx",
    "Account": "xxxxxxx",
    "Arn": "arn:aws:iam::xxxxxx:user/bar"
}
13
10
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
13
10