Skip to content

Commit f73e734

Browse files
authored
Merge pull request #20 from route06/issue-7-specify-accounts
Add function to get cost info of specific account under an organization
2 parents fcb59cc + 0eb8cb7 commit f73e734

10 files changed

+325
-20
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pnpm-lock.yaml
22
CHANGELOG.md
33
eslint.config.js
4+
tsconfig.json

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,21 @@
6363
"ora": "^6.1.2"
6464
},
6565
"devDependencies": {
66+
"@aws-sdk/client-organizations": "^3.588.0",
6667
"@babel/core": "^7.24.6",
6768
"@babel/preset-env": "^7.24.6",
6869
"@babel/preset-typescript": "^7.24.6",
6970
"@eslint/js": "^9.4.0",
7071
"@smithy/types": "^3.0.0",
72+
"@types/aws-sdk": "^2.7.0",
7173
"@types/eslint__js": "^8.42.3",
7274
"@types/jest": "^29.5.12",
7375
"@types/node": "^18.11.18",
7476
"@typescript-eslint/eslint-plugin": "^7.11.0",
7577
"@typescript-eslint/parser": "^7.11.0",
7678
"aws-sdk-client-mock": "^2.2.0",
7779
"aws-sdk-client-mock-jest": "^4.0.0",
80+
"aws-sdk-mock": "^6.0.1",
7881
"babel-jest": "^29.7.0",
7982
"eslint": "^9.4.0",
8083
"jest": "^29.7.0",

pnpm-lock.yaml

+121
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For the simple usage, just run the command without any options.
2020
aws-cost
2121
```
2222

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

2525
```bash
2626
$ aws-cost --help
@@ -34,9 +34,11 @@ $ aws-cost --help
3434

3535
-k, --access-key [key] AWS access key
3636
-s, --secret-key [key] AWS secret key
37+
-t, --session-token [key] AWS session token
3738
-r, --region [region] AWS region (default: us-east-1)
3839
-a, --role-arn [arn] AWS role ARN to assume
3940

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

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

75+
If you need to query cost info of another account under your organization, you can pass the `--target-account` option:
76+
77+
```bash
78+
aws-cost --target-account 123456789012
79+
```
80+
7381
## Detailed Breakdown
7482

7583
> The default usage is to get the cost breakdown by service

0 commit comments

Comments
 (0)