Skip to content

Unable to override aws_default connection values from UI #18276

Closed

Description

@vschettino

Apache Airflow version

2.0.2

Operating System

Centos 8

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==2.2.0
apache-airflow-providers-ftp==2.0.1
apache-airflow-providers-http==2.0.1
apache-airflow-providers-imap==2.0.1
apache-airflow-providers-sqlite==2.0.1

Deployment

MWAA

Deployment details

The problem happens both on a local docker container and MWAA.

What happened

I am trying to set a user for aws_default connection in order to be able to run Fargate Tasks and access AWS Parameter Store during DAG execution. According to the docs:

The default connection ID is aws_default. If the environment/machine where you are running Airflow has the file credentials in /home/.aws/, and the default connection has user and pass fields empty, it will take automatically the credentials from there.

What happens is that no matter how I set up those values, the default connection is always empty:?

[2021-09-15 16:04:06,915] {{standard_task_runner.py:77}} INFO - Job 16: Subtask data-mwaa-lab
[2021-09-15 16:04:07,060] {{logging_mixin.py:104}} INFO - [2021-09-15 16:04:07,060] {{base_aws.py:368}} INFO - Airflow Connection: aws_conn_id=aws_default
[2021-09-15 16:04:07,111] {{logging_mixin.py:104}} INFO - [2021-09-15 16:04:07,111] {{base_aws.py:179}} INFO - No credentials retrieved from Connection
[2021-09-15 16:04:07,139] {{logging_mixin.py:104}} INFO - [2021-09-15 16:04:07,139] {{base_aws.py:87}} INFO - Creating session with aws_access_key_id=None region_name=us-east-2
[2021-09-15 16:04:07,179] {{logging_mixin.py:104}} INFO - [2021-09-15 16:04:07,179] {{base_aws.py:157}} INFO - role_arn is None

What you expected to happen

I understand that setting Login and Password on the UI (connection/edit/2) those values should be used instead of reaching for the /home/.aws/ file, that will be empty. When I create a identical connection called aws, the fargate task is correctly launched. The problem here is that I need this to be the default connection to reach for Parameter Store values in order to configure the dag run.

How to reproduce

I was able to reproduce the same issue using a docker container on my machine and on an old Airflow 1.x instance. Just setting valid AWS credentials via UI on Login/Pass of connection aws_default do not work.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. boring-cyborg commented on Sep 15, 2021

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template!

  2. mik-laj commented on Sep 15, 2021

    @mik-laj
    Member

    Can you check if the connection is correctly saved in the database? Preferably with the help of CLI.

    $ airflow connections get aws_default --output yaml
    
  3. vschettino commented on Sep 16, 2021

    @vschettino
    Author

    @mik-laj thanks for the quick reply! Debugging further I saw that this is a matter of logging. The credentials are actually loaded and I can use them further on my code, but this line was misleading:

    [2021-09-15 16:04:07,111] {{logging_mixin.py:104}} INFO - [2021-09-15 16:04:07,111] {{base_aws.py:179}} INFO - No credentials retrieved from Connection
    [2021-09-15 16:04:07,139] {{logging_mixin.py:104}} INFO - [2021-09-15 16:04:07,139] {{base_aws.py:87}} INFO - Creating session with aws_access_key_id=None region_name=us-east-2
    
  4. mik-laj commented on Sep 16, 2021

    @mik-laj
    Member

    @author Would you like to submit a contribution to improve this message? I am happy to help with the review.

  5. vschettino commented on Sep 16, 2021

    @vschettino
    Author

    Sure! can you point me any direction for starters?

  6. mik-laj commented on Sep 16, 2021

    @mik-laj
    Member
  7. eladkal commented on Aug 23, 2022

    @eladkal
    Contributor

    Is this still an issue after #25416 and #25256
    cc @Taragolis

  8. Taragolis commented on Aug 24, 2022

    @Taragolis
    Contributor

    After changes AwsBaseHook won't show No credentials retrieved from Connection and also boto3/botocore should show actual source of credentials, e.g. Found credentials in shared credentials file: ~/.aws/credentials

  9. github-actions commented on Sep 24, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has been open for 30 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.

  10. added
    staleStale PRs per the .github/workflows/stale.yml policy file
    on Sep 24, 2022
  11. github-actions commented on Oct 1, 2022

    @github-actions
    Contributor

    This issue has been closed because it has not received response from the issue author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions