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
npminstall - Run
npm ito 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.jsononce 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 ito install packages - Ensure you have
jqinstalled (brew install jq) - Give
run_on_aws_management_account.shpermission 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-identityand checking if the outputedAccountfield 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
OrganizationAccountAccessRoleby default, or an otherwise specified role.OrganizationAccountAccessRoleis 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.jsonwhich will contain estimated Plerion Unit consumption data for your entire Organization
- Install kubernetes and ensure
kubectlcommand runs locally. Further information on Kubernetes installation can be found here. - Ensure kubernetes context and authentication is properly configured. Use command
kubectl config current-contextto 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 ito 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.jsononce it has finished running. TheK8S-output.jsonfile should consist count of each Kubernetes resources underresourcesattribute whenverboseflag is enabled.