Hi
We're in the process of moving over from Databricks in Azure to AWS.
I am trying to establish a method of accessing secrets from AWS Secrets Manager (we were using Azure KeyVault) and understand this can be done with boto as suggested from AWS.
We have created all of the relevant IAM roles, instance profiles etc. Accessing S3 with this method is working OK.
However, whenever I try to interact with Secrets Manager I keep getting the "NoCredentialsError: Unable to locate credentials" error.
The role assigned to the EC2 after creation has the relevant permission to read/write from Secrets Manager.
I'm at a dead end and appreciate any help.
Many Thanks
Example code:
import botocore
import botocore.session
from aws_secretsmanager_caching import SecretCache, SecretCacheConfig
client = botocore.session.get_session().create_client('secretsmanager', region_name='aws-region')
cache_config = SecretCacheConfig()
cache = SecretCache( config = cache_config, client = client)
secret = cache.get_secret_string('secretname')