I run airflow in docker and has volumes setting as
- ~/.aws:/usr/local/airflow/.aws:rw
I can see my local ~/.aws/credentials has:
[some_profile]
aws_access_key_id = xxxxx
aws_secret_access_key = xxxxx
and I can see the same content in airflow worker /usr/local/airflow/.aws/credentials
, and aws configure list
can return expected results like:
Name Value Type Location
---- ----- ---- --------
profile datalake env ['xxx_PROFILE', 'AWS_PROFILE']
access_key ****************xxxx shared-credentials-file
secret_key ****************xxxx shared-credentials-file
region <not set> None None
and cmd like aws s3 ls
works locally. However for
sts_client = boto3.client('sts')
assumed_role = sts_client.assume_role(RoleArn=role_arn, RoleSessionName='xxx')
it throws:
botocore.exceptions.NoCredentialsError: Unable to locate credentials
What am I missing here? Thanks.