Can an AWS Secret be used in Build?

I have a secret stored in AWS Secrets manager. I have a need to grab this secret in Circle and store it as an ENV to be used later in the job passing the secret into the ‘docker build --secret …’
AI is telling me to use something like: ‘export ENV_VAR=aws secretsmanager get-secret-value --secret-id “arn:aws:secretsmanager:…” --output text’
But this is failing with errors like ‘not a valid identifier’

Is this possible? Can someone help me out with the proper syntax for grabbing an aws secret and using it?

May need some other stuff as well, but at a minimum, you probably need to use backticks or $() around the command. Also, using export may not work exactly as you’d expect otherwise. Seen notes about $BASH_ENV at Introduction to environment variables - CircleCI