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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pnpm-lock.yaml
CHANGELOG.md
eslint.config.js
tsconfig.json
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@
"ora": "^6.1.2"
},
"devDependencies": {
"@aws-sdk/client-organizations": "^3.588.0",
"@babel/core": "^7.24.6",
"@babel/preset-env": "^7.24.6",
"@babel/preset-typescript": "^7.24.6",
"@eslint/js": "^9.4.0",
"@smithy/types": "^3.0.0",
"@types/aws-sdk": "^2.7.0",
"@types/eslint__js": "^8.42.3",
"@types/jest": "^29.5.12",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"aws-sdk-client-mock": "^2.2.0",
"aws-sdk-client-mock-jest": "^4.0.0",
"aws-sdk-mock": "^6.0.1",
"babel-jest": "^29.7.0",
"eslint": "^9.4.0",
"jest": "^29.7.0",
Expand Down
121 changes: 121 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For the simple usage, just run the command without any options.
aws-cost
```

The output will be a the totals with breakdown by service. Optionally, you can pass the following options to modify the output:
The output will be the totals with breakdown by service. Optionally, you can pass the following options to modify the output:

```bash
$ aws-cost --help
Expand All @@ -34,9 +34,11 @@ $ aws-cost --help

-k, --access-key [key] AWS access key
-s, --secret-key [key] AWS secret key
-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

-T, --target-account [id] Account ID to see cost
-p, --profile [profile] AWS profile to use (default: "default")

-j, --json Get the output as JSON
Expand Down Expand Up @@ -70,6 +72,12 @@ If you need to assume a role, you can pass the `role-arn` option:
aws-cost -a arn:aws:iam::123456789012:role/your-role-arn
```

If you need to query cost info of another account under your organization, you can pass the `--target-account` option:

```bash
aws-cost --target-account 123456789012
```

## Detailed Breakdown

> The default usage is to get the cost breakdown by service
Expand Down
Loading