The environment variable of Bedrock API key is AWS_BEARER_TOKEN_BEDROCK, ref: https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-use.html
Successful case:
python -c "
import os
os.environ['AWS_BEARER_TOKEN_BEDROCK'] = 'XXXXXXXXXXXX'
os.environ['AWS_REGION'] = 'us-east-1'
from strands import Agent
agent = Agent()
agent('Hello')
"
Hello! How are you doing today? Is there anything I can help you with?
Failed case:
python -c "
import os
os.environ['AWS_BEDROCK_API_KEY'] = 'XXXXXXXXXXXX'
os.environ['AWS_REGION'] = 'us-east-1'
from strands import Agent
agent = Agent()
agent('Hello')
"
ERROR: File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/botocore/auth.py", line 422, in add_auth raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials