Hi
I am trying to establish a method of accessing secrets from AWS Secrets Manager 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 well.
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 boto3
session = boto3.Session(region_name=region_name)
# Create a Secrets Manager client using instance profile/IAM role
client = session.client(service_name='secretsmanager')
# Get the secret value
response = client.get_secret_value(
SecretId=secret_id
)