A tool which returns the total number of assets Plerion will monitor.
- Ensure you have AWS CLI access. You can test this by running the following command and observing the output:
aws sts get-caller-identity
It should return the Account ID that you're wanting to run the asset counter over. Note that we are limited to whatever role you're using in the CLI.
- Ensure you have
npm
install - Run
npm i
to install packages - Run
node index.js -p AWS
- Can also be run on the service level
node index.js -p AWS -s IAM
- Or the resource type level
node index.js -p AWS -r AWS::IAM::Role
- You may also include verbose logging which will give you asset counts on the resource level
node index.js -p AWS -v
- Can also be run on the service level
- Open up
AWS-output.json
once it has finished running. Errors may throw which is fine as some AWS APIs return an error if there are no resources in that region.
docker build -t asset-counter .
docker run --rm -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN asset-counter -p AWS
- Run
npm i
to install packages - Ensure you have
jq
installed (brew install jq
) - Give
run_on_aws_management_account.sh
permission to run.chmod +x run_on_aws_management_account.sh
- Assume Role into your AWS Organization Management Account using admin access
- You can verify this by running
aws sts get-caller-identity
and checking if the outputedAccount
field is the same as the AWS Organization Management Account's id - Run the script
./run_on_aws_management_account.sh
- For each member account it will assume either the
OrganizationAccountAccessRole
by default, or an otherwise specified role.OrganizationAccountAccessRole
is a default role which managed accounts automatically have. - If you have many member accounts this script may take some time to run. Each time a member account's run has completed it'll create a new file called
<awsAccountId>-AWS-Output.json
- Once completely done it will create a file
AWS-Organization-output.json
which will contain estimated Plerion Unit consumption data for your entire Organization
- Install kubernetes and ensure
kubectl
command runs locally. Further information on Kubernetes installation can be found here. - Ensure kubernetes context and authentication is properly configured. Use command
kubectl config current-context
to verify.- For AWS EKS, authentication can be done using:
aws eks update-kubeconfig --region <region> --name <cluster-name>
- For AWS EKS, authentication can be done using:
- Run
npm i
to install packages - Run
node index.js -p K8S
- Can also be run on the resource level
node index.js -p K8S -r po,ns
- You may also include verbose logging which will give you resource counts
node index.js -p K8S -v
- Can also be run on the resource level
- Open up
K8S-output.json
once it has finished running. TheK8S-output.json
file should consist count of each Kubernetes resources underresources
attribute whenverbose
flag is enabled.