Boavizta / cloud-scanner

📡 Get Boavizta impact data for your aws cloud account usage.
GNU Affero General Public License v3.0
34 stars 8 forks source link

Compilation error : thread 'main' panicked at 'called `Result::unwrap()` #76

Closed albanducos87 closed 2 years ago

albanducos87 commented 2 years ago

Hello When I'm trying to build the cloud scanner, there is an issue that stops me. I'm trying to run the following command : cargo run --bin cloud-scanner-cli standard --hours-use-time 10 | jq

And here is the error : image

Do you have a solution please ? Thanks !

demeringo commented 2 years ago

Hi @albanducos87, thanks for reporting the issue.

I suspect it is not stritcly a compilation error but rather a runtime error (due to missing credentials).

Do you have an AWS profile already set up on your computer ? I mean a profile or set of aws credentials like what is expected by AWS CLI.

You probably have to create an environment variable that points to this profile:

On Linux / os x: export AWS_PROFILE='<YOUR_PROFILE_NAME>'

On Windows set AWS_PROFILE=<YOUR_PROFILE_NAME>

💡 There are alternate methods to pass only the aws access key and secret described here: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html, but I did not test them.

Once the environment is set, you should be able to run the command.

cargo run --bin cloud-scanner-cli standard --hours-use-time 10 | jq

I currently do not have a Windows environment at hand to test so if you have the opportunity to test on of the above method, your feedback would be greatly appreciated so that we can improve the doc 🙏.

demeringo commented 2 years ago

The method I tested so far (on Linux) is the one described here (i.e. using named profiles). https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

But yes, we definitely need to support other methods, and document them properly ! I opened a dedicated issue to not forget it #77

albanducos87 commented 2 years ago

Hello I have an aws account, it has been created by my company, I have done the command set AWS_PROFILE=<YOUR_PROFILE_NAME> and it is the same issue. I'm working on a Windows device. It looks like the program can't launch the cloud-scanner-cli.exe with this command : cloud-scanner-cli.exe standard --hours-use-time 10

albanducos87 commented 2 years ago

I think I've found a solution for my problem, I didn't configure awscli on my computer, I entered the command aws configure and followed the instructions and now I just need access to IAM to get my aws_secret_access_key. I'll keep you informed

albanducos87 commented 2 years ago

It is now working, I just didn't have the access and the good aws informations from my compagny. Thank you !

demeringo commented 2 years ago

Thank you very much for your feedback @albanducos87, I will make sure to use it to improve our documentation.