np-guard / cloud-resource-collector

Collects cloud resources in a given account. Supports multiple cloud providers.
https://pkg.go.dev/github.com/np-guard/cloud-resource-collector
Apache License 2.0
2 stars 0 forks source link
firewall-configuration network-configuration routing-tables vpc vpc-resources

cloud-resource-collector

Collects cloud resources in a given account. Supports multiple cloud providers.

Prerequisites

Setup the AWS Collector

The AWS Collector requires you to provide credential information. You can do this either by setting up a shared credential file or by setting environment variables.

To setup the credential file, simply create a text file with the following content (replacing the keys with your AWS keys)

[default]
aws_access_key_id = YOUR_AWS_ACCESS_KEY_ID
aws_secret_access_key = YOUR_AWS_SECRET_ACCESS_KEY

If you are using Windows save the file under C:\Users\<yourUserName>\.aws\credentials. If you are using Linux, MacOS, or Unix save the file under ~/.aws/credentials

Alternatively, you can set the following environment variables:

export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY

Note: Pagination is not yet implemented, the collector will return only the first page of resources.

Setup the IBM Collector

The IBM collector requires an IBM API key to be supplied through the following environment variable:

export IBMCLOUD_API_KEY=<ibm-cloud-api-key>

Usage

Collecting resources

./bin/collector collect --provider <provider> [flags]

Flags:
  -h, --help                    help for collect
      --out string              file path to store results
  -r, --region stringArray      cloud region from which to collect resources
      --resource-group string   resource group id or name from which to collect resources

Listing available regions

./bin/collector get-regions --provider <provider>

Build the project

Requires Go version 1.22 or later.

git clone git@github.com:np-guard/cloud-resource-collector.git
cd cloud-resource-collector
make build