Skip to content

Commit

Permalink
Merge pull request #20 from route06/issue-7-specify-accounts
Browse files Browse the repository at this point in the history
Add function to get cost info of specific account under an organization
  • Loading branch information
Rindrics authored Jun 14, 2024
2 parents fcb59cc + 0eb8cb7 commit f73e734
Show file tree
Hide file tree
Showing 10 changed files with 325 additions and 20 deletions.
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

0 comments on commit f73e734

Please sign in to comment.