Content uses an external cli that requires a credentials file with access_key and private_key

I'm deploying a Quarto doc on Posit Connect that includes system() calls leveraging a third-party cli (let's say for the sake of argument that it's aws cli - but it isn't). The use of this cli requires a credentials file with an access key and private key.

I've installed the cli on the Posit Connect host server and created a credentials file at the home directory under ./[.vendor]/credentials. I've verified that the cli is working and authenticated when I ssh into the server.

However, once I try to deploy content on Posit Connect that executes the same cli commands. I get an error like:

No credentials found anywhere in chain. The shared credentials file should be stored at /opt/rstudio-connect/mnt/tmp/.[vendor]/credentials.

It wants the credentials stored under a tmp directory inside of the rstudio-connect folder, but my understanding is that I shouldn't modify rstudio-connect much less store credentials in a tmp folder. How can I configure my deployment or Posit Connect server to see my credentials?

I should add I've also tried deploying the content with a .[vendor]/credentials file in the deploy file structure itself (i.e., adding the file in the deploy to Connect wizard). This has the same outcome.

I may not be understanding where you put the file initially; are you saying you already tried

/home/rstudio-connect/.aws/credentials?

You might try creating a Linxu user other than the rstudio-connect user, placing the configuration file in that user's home directory, and then setting that user as the runAs user for content requiring the CLI.

Where I had initially put the credentials file was just in the home directory. I actually managed to fix the problem by running manual configuration commands during the runtime of the Quarto doc.

If I wanted it to read from a credentials file should I try placing it in /home/rstudio-connect/.aws? I read in the documentation that it's not advisable to edit the rstudio-connect directory.

I edited this into my previous comment after posting it initially, so sorry to repeat myself:

you might try creating a Linux user other than the rstudio-connect user, placing the configuration file in that user's home directory, and then setting that user as the runAs user for content requiring the CLI.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.