jorgebastida / awslogs

AWS CloudWatch logs for Humans™
Other
4.86k stars 336 forks source link

awslogs command doesn't work #398

Closed valeriudev closed 8 months ago

valeriudev commented 10 months ago

Version: 0.14.0 Python: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] boto3 version: 1.34.16 Platform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 Args: ['/home/valgutu/.local/bin/awslogs', '--profile=dashfx', 'groups'] Config: {'aws_access_key_id': 'SENSITIVE', 'aws_secret_access_key': 'SENSITIVE', 'aws_session_token': 'SENSITIVE', 'aws_profile': 'SENSITIVE', 'aws_region': None, 'aws_endpoint_url': None, 'log_group_prefix': None, 'func': 'list_groups'}

Traceback (most recent call last):
  File "/home/valgutu/.local/lib/python3.10/site-packages/awslogs/bin.py", line 175, in main
    logs = AWSLogs(**vars(options))
  File "/home/valgutu/.local/lib/python3.10/site-packages/awslogs/core.py", line 89, in __init__
    self.client = boto3_client(
  File "/home/valgutu/.local/lib/python3.10/site-packages/awslogs/core.py", line 44, in boto3_client
    return session.client(
  File "/home/valgutu/.local/lib/python3.10/site-packages/boto3/session.py", line 299, in client
    return self._session.create_client(
  File "/home/valgutu/.local/lib/python3.10/site-packages/botocore/session.py", line 957, in create_client
    credentials = self.get_credentials()
  File "/home/valgutu/.local/lib/python3.10/site-packages/botocore/session.py", line 515, in get_credentials
    ).load_credentials()
  File "/home/valgutu/.local/lib/python3.10/site-packages/botocore/credentials.py", line 2074, in load_credentials
    creds = provider.load()
  File "/home/valgutu/.local/lib/python3.10/site-packages/botocore/credentials.py", line 1483, in load
    return self._load_creds_via_assume_role(self._profile_name)
  File "/home/valgutu/.local/lib/python3.10/site-packages/botocore/credentials.py", line 1498, in _load_creds_via_assume_role
    source_credentials = self._resolve_source_credentials(
  File "/home/valgutu/.local/lib/python3.10/site-packages/botocore/credentials.py", line 1665, in _resolve_source_credentials
    return self._resolve_credentials_from_profile(source_profile)
  File "/home/valgutu/.local/lib/python3.10/site-packages/botocore/credentials.py", line 1693, in _resolve_credentials_from_profile
    raise InvalidConfigError(
botocore.exceptions.InvalidConfigError: The source profile "default" must have credentials.

image

nijave commented 8 months ago

Make sure aws sts get-caller-identity returns valid credentials. It looks like you don't have credentials setup correctly

jorgebastida commented 8 months ago

It looks like the profile (dashfx) you are using is not correctly configured. Seems like you are using the source_profile config, and the source profile (default) doesn't have credentials configured.

I have no experience with this kind of setup, but as @nijave suggested I would recommend you to make sure the profile you are using is correctly configured.

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html