Skip to content

Commit 48557cb

Browse files
committed
GROW-621: Improve documentation of authentication options
1 parent 7578a67 commit 48557cb

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

README.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
![Build, Lint and Test](https://github.com/expel-io/aws-resource-counter/workflows/Build,%20Lint%20and%20Test/badge.svg?branch=main) ![Release with goreleaser](https://github.com/expel-io/aws-resource-counter/workflows/Release%20with%20goreleaser/badge.svg)
44

5-
Go utility for counting the resources in use in an AWS organization.
5+
Command-line utility for counting the resources in use in an AWS organization.
66

77
The AWS resource counter utility known as "aws-resource-counter" inspects
88
a cloud deployment on Amazon Web Services to assess the number of
9-
distinct computing resources. The result is a CSV file that describes the counts
10-
of each.
9+
distinct compute and storage resources. The result is a CSV file that describes
10+
the counts of each.
1111

1212
This repository started out as [cloud-resource-counter](https://github.com/expel-io/cloud-resource-counter). Reference the archived repository to view its entire history.
1313

@@ -40,32 +40,55 @@ This repository started out as [cloud-resource-counter](https://github.com/expel
4040
* [Lightsail Instances](#lightsail-instances)
4141
* [S3 Buckets](#s3-buckets)
4242

43-
## Command Line
43+
## Prerequisites
4444

45-
This command line tool requires access to a valid AWS Account. It assumes that the credentials for an account are stored in an AWS configuration folder (e.g., `$HOME/.aws`). You may store several sets of credentials, each being denoted by its own "profile name".
45+
* Access to the AWS accounts from which you want to obtain counts
46+
(see [Minimal IAM Policy](#minimal-iam-policy) for details)
47+
* The AWS CLI v2 (see [Installing the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)
48+
for details).
4649

47-
If you omit a profile (or the profile you specify does not contain credentials), this tool will check for AWS environment variables that contain the access key and secret access key. This enables tools such as HashiCorp's Vault to work seamlessly with the tool.
50+
## Authentication
4851

49-
If you have ever run the AWS CLI, you will already have these profiles configured. This tool uses the same mechanism of retrieving and using stored credentials.
52+
This command line tool requires access to a valid AWS Account, and uses the same credential mechanisms as the AWS CLI.
53+
There are several ways to provide credentials.
5054

51-
### AWS CLI Setup
55+
### Environment variables
56+
If you do not specify a profile when running the tool, or the profile you specify does not contain credentials, the
57+
tool will use the following environment variables. This enables tools such as HashiCorp's Vault to work seamlessly
58+
with the tool.
5259

53-
If you have not yet stored credentials for your AWS accounts, you must first install the AWS CLI v2 (see [Installing the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) for details).
60+
* AWS_ACCESS_KEY_ID
61+
* AWS_SECRET_ACCESS_KEY
62+
* AWS_SESSION_TOKEN
5463

55-
### Saving Credentials in a Profile
64+
These can be long-lived credentials, or can be short-term credentials obtained from the
65+
`Command line or programmatic access` section of the AWS SSO account selection page. For a single run of the tool
66+
using an SSO account, this is the simplest method. Do not pass `--sso` to the tool if you use this method, even
67+
if the environment variables are short-term credentials created by an SSO account.
5668

57-
If you already have AWS CLI installed, you would simply run:
69+
### Credential profiles
70+
If you have ever run the AWS CLI, you will already have at least one profile configured. This tool uses the same
71+
mechanism of retrieving and using stored credentials. You may store several sets of credentials, each being denoted
72+
by its own "profile name".
73+
74+
To create a new profile, run:
5875

5976
```bash
6077
$ aws configure --profile some-profile-name
6178
AWS Access Key ID [None]: ...
6279
```
6380

64-
where `some-profile-name` is the name you would like to use to name this set of credentials. You would be prompted for several strings (AWS Access Key ID, AWS Secret Access Key, Default region name, Default output format).
81+
where `some-profile-name` is the name you would like to use to name this set of credentials. You would be prompted for
82+
several strings (AWS Access Key ID, AWS Secret Access Key, Default region name, Default output format).
6583

6684
For help on storing AWS credentials, see [Configuration Basics](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html).
6785

68-
### Using aws-resource-counter
86+
### On-demand SSO access
87+
To use an SSO-enabled account without copying short-term credentials into an environment variable,
88+
see [Configure the AWS CLI to use AWS IAM Identity Center](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html).
89+
Pass `--sso` to the aws-resource-counter tool when you run it.
90+
91+
## Using aws-resource-counter
6992

7093
The following command line arguments are supported:
7194

@@ -183,7 +206,7 @@ If you are using MacOS Catalina, there is a stricter process for running binarie
183206
184207
## Building from Source
185208
186-
You can also build this utility directly from source. We have built and tested this with the following Go versions:
209+
`aws-resource-counter` is written in Go. You can build and run it directly from source. We have built and tested this with the following Go versions:
187210
188211
* v1.21
189212

0 commit comments

Comments
 (0)