-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to get cost info of specific account under an organization #20
Conversation
reason why need this: - want to support accounts that have not yet created aliases - This is because aliases [are public information](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html) and there may be some decision-making costs involved in determining them - I want to make this tool available to organisations that have not gone through this. Alias of other account is unavailable because `listAccountAliases` does not accept argument `account_id`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't run it, and I have added comments, but the content seems fine to me 🙆♂️
readme.md
Outdated
-t, --session-token [key] AWS session token | ||
-r, --region [region] AWS region (default: us-east-1) | ||
-a, --role-arn [arn] AWS role ARN to assume | ||
|
||
--target-account [id] Account ID to see cost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Troublesome, but no good idea comes to mind 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added 0eb8cb7
import AWS from 'aws-sdk'; | ||
import { AWSConfig } from './config'; | ||
import { showSpinner } from './logger'; | ||
|
||
export async function getAccountAlias(awsConfig: AWSConfig): Promise<string> { | ||
showSpinner('Getting account alias'); | ||
|
||
if (awsConfig.targetAccount) { | ||
const organizations = new OrganizationsClient({ | ||
region: 'us-east-1', // Organizations API is only available in us-east-1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't know that !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
thx! |
close #7