Skip to content
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

Merged
merged 4 commits into from
Jun 14, 2024

Conversation

Rindrics
Copy link
Collaborator

close #7

Rindrics and others added 2 commits June 13, 2024 18:36
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`
@Rindrics Rindrics self-assigned this Jun 13, 2024
@Rindrics Rindrics requested a review from a team June 13, 2024 09:47
Copy link

@bvlion bvlion left a 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
Comment on lines 37 to 41
-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
Copy link

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 🤔

Copy link
Collaborator Author

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
Copy link

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 !!

@Rindrics Rindrics requested a review from bvlion June 14, 2024 03:18
Copy link

@bvlion bvlion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Rindrics
Copy link
Collaborator Author

thx!

@Rindrics Rindrics merged commit f73e734 into main Jun 14, 2024
1 check passed
@Rindrics Rindrics deleted the issue-7-specify-accounts branch June 14, 2024 09:56
This was referenced Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add functionality to specify accounts under the org
2 participants