AWS Account ID を知る方法
はじめに
異なるAWSアカウント間でVPC Peering する場合などには接続先のAWS Account ID を指定する必要があります。しかし意外と取得する方法がわからなくて困ってたので共有します。もっと簡単に知る方法あれば教えてください。
AWS Account ID を知る方法
1. AWS マネジメントコンソールから
AWS マネジメントコンソールに入ったときにロールの選択のところでアカウント名の横のカッコに記載されている数字列がAWS Account ID です。
2. AWS CLI から
https://dev.classmethod.jp/cloud/aws/get-aws-account-id-with-get-caller-identity/ この記事で知りました。 GetCallerIdentity
というのがあるらしい。
例
$ aws sts get-caller-identity
{
"Account": "0123456789012",
"UserId": "ABCD1234EFGHGELEGSL3",
"Arn": "arn:aws:iam::012345678901234:user/ユーザ名"
}
クレデンシャルのプロフィール指定したいならこう。
$ aws sts get-caller-identity --profile mikaji
{
"Account": "0123456789012",
"UserId": "ABCD1234EFGHGELEGSL3",
"Arn": "arn:aws:iam::012345678901234:user/ユーザ名"
}
おわりに
AWS CLI イイネ
Author And Source
この問題について(AWS Account ID を知る方法), 我々は、より多くの情報をここで見つけました https://qiita.com/mikaji/items/b23377f9903ba183a680著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .