awscli-login icon indicating copy to clipboard operation
awscli-login copied to clipboard

Update for AWS V2

Open edthedev opened this issue 2 years ago • 3 comments

  • [ ] recreate script entry point so that it only creates credential file necessary for aws cli
  • [ ] remove all dependencies on aws cli Python libraries, as these are no longer accessible. Use standard ConfigParser instead.
  • [ ] stretch: make the import conditional - use aws cli libraries when available
  • [ ] update any current functionality that depends on aws cli Python libraries to be optional - using try/catch conditional imports
  • [ ] update README to explain which functionality will only be available if aws cli is installed
  • [ ] update setup to not depend on aws cli login
  • [ ] update README to clarify that installing aws cli login no longer installs aws cli

edthedev avatar Jul 06 '22 14:07 edthedev

The first thing I would like to try is sourcing credentials with an external process: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html. This would make a big change in how credentials are rotated so I would like to make the change sooner rather than latter so Jon could test it out.

ddriddle avatar Jul 07 '22 19:07 ddriddle

@ddriddle Troubleshooting errors today and keep running into the following error:

$ aws login --verbose --verbose --verbose --verbose
config.py:125:awscli_login.config:Loaded config file: /home/zdc/.aws-login/config
config.py:178:awscli_login.config:Loaded login profile: default
credentials.py:2094:botocore.credentials:Looking for credentials via: env
credentials.py:2094:botocore.credentials:Looking for credentials via: assume-role
credentials.py:2094:botocore.credentials:Looking for credentials via: assume-role-with-web-identity
credentials.py:2094:botocore.credentials:Looking for credentials via: sso
credentials.py:2094:botocore.credentials:Looking for credentials via: shared-credentials-file
credentials.py:2094:botocore.credentials:Looking for credentials via: custom-process
__main__.py:88:awscli_login:Error when retrieving credentials from custom-process: 'Profile' object has no attribute 'verbose'

__main__.py:91:awscli_login:
Traceback (most recent call last):
  File "/home/zdc/dev/projects/awscli-login/src/awscli_login/__main__.py", line 77, in wrapper
    f(profile, session, interactive)
  File "/home/zdc/dev/projects/awscli-login/src/awscli_login/__main__.py", line 103, in login
    client = session.create_client('sts')
  File "/home/zdc/dev/projects/awscli-login/venv/lib/python3.9/site-packages/botocore/session.py", line 926, in create_client
    credentials = self.get_credentials()
  File "/home/zdc/dev/projects/awscli-login/venv/lib/python3.9/site-packages/botocore/session.py", line 495, in get_credentials
    self._credentials = self._components.get_component(
  File "/home/zdc/dev/projects/awscli-login/venv/lib/python3.9/site-packages/botocore/credentials.py", line 2095, in load_credentials
    creds = provider.load()
  File "/home/zdc/dev/projects/awscli-login/venv/lib/python3.9/site-packages/botocore/credentials.py", line 1033, in load
    creds_dict = self._retrieve_credentials_using(credential_process)
  File "/home/zdc/dev/projects/awscli-login/venv/lib/python3.9/site-packages/botocore/credentials.py", line 1057, in _retrieve_credentials_using
    raise CredentialRetrievalError(
botocore.exceptions.CredentialRetrievalError: Error when retrieving credentials from custom-process: 'Profile' object has no attribute 'verbose'

We are wondering if this is because we are still using awscli v1 and we should switch to V2 at this point. V2 does not appear to be on pip, so we aren't sure what the plan was to use V2.

zdc217 avatar Jul 21 '22 20:07 zdc217

@zdc217 aws decided to stop supporting pip with V2 even though many customers loudly protested that decision. In theory because they may refactor the tool to use a different langauge.

The problem is not likely due to the version of awscli being used. I think the script is failing:

__main__.py:88:awscli_login:Error when retrieving credentials from custom-process: 'Profile' object has no attribute 'verbose'

Looks like the verbose attribute is not being set.

ddriddle avatar Jul 25 '22 15:07 ddriddle

Closing as stale. Work is continuing on #95 and #96

zdc217 avatar Oct 06 '22 15:10 zdc217