0
votes

My code is in R. And I need to excess external database. I am storing database credentials in AWS Secret Manager.

So I first tried using paws library to get aws secrets in R but that would require storing access key, secret id and session token, and I want to avoid that.

Is there a better way to do this? I have created IAM role for Sagemaker. Is it possible to pass secrets as environment variables?

Edit: I wanted to trigger Sagemaker Processing

2
@Adiii I was hoping I could use IAM role somehow instead of setting hyperparams since the keys required for secret manager would be temporary - Abhilash Chaturvedi

2 Answers

0
votes

You should be able to use Paws for this. According to documentation it will use the IAM role configured for your Sagemaker instance

If you are running the package on an instance with an appropriate IAM role, Paws will use it automatically and you don’t need to do anything extra.

You only have to add the relevant access permissions (e.g. Allow ssm:GetParameters) to the Sagemaker IAM role.

0
votes

I found a simple solution to it. Env variables can be passed via Sagemaker sdk. It minimizes the dependencies.

https://sagemaker.readthedocs.io/en/stable/api/training/processing.html

As another answer suggested, paws can be used as well to get secrets from aws. This would be a better approach