Hi, I'm trying to access secrets in a flow using A...
# ask-metaflow
b
Hi, I'm trying to access secrets in a flow using AWS Secrets Manager, I have the backend set up correctly and I'm following this guide https://docs.metaflow.org/scaling/secrets Which states I can rename secret names from secret manager like
Copy code
@secrets(sources=[{"id": "mysecret", {"options": {"env_var_name": "MY_SECRET"}}])
But this is incorrect python syntax
Copy code
Cell In[3], line 1
    sources=[{"id": "mysecret", {"options": {"env_var_name": "MY_SECRET"}}]
                                                                          ^
SyntaxError: closing parenthesis ']' does not match opening parenthesis '{'
Adding the missing bracket gives the following
Copy code
sources=[{"id": "mysecret", {"options": {"env_var_name": "MY_SECRET"}}}]
                                                                         ^
SyntaxError: ':' expected after dictionary key
So what is the correct format for doing this in python?
Copy code
sources=[{"id": "mysecret", "options": {"env_var_name": "MY_SECRET"}}]
Doesnt seem to rename any secrets
Also, is there a way to access secrets as a string instead of as env variables, like the secret string from a boto3 response?
Copy code
secret_client = boto3.client(service_name='secretsmanager')
get_secret_value_response = secret_client.get_secret_value(SecretId="my-secret")

secret_string = get_secret_value_response["SecretString"])