jorgebastida / jorgebastida/awslogs
Can't use non-default profile
- Dominant language
- Python
- Stars
- 5k
- Forks
- 342
- PR merge metrics
- No merged PRs in 30d
Description
`awslogs get` works if I replace my default profile with the profile I want to use, but doesn't if I try to specify the profile with the args `--profile`.
```
Version: 0.14.0
Python: 3.9.0 (default, Nov 14 2020, 10:50:03)
[Clang 12.0.0 (clang-1200.0.32.27)]
boto3 version: 1.14.20
Platform: macOS-11.0.1-x86_64-i386-64bit
Args: ['/usr/local/bin/awslogs', 'get', '/aws/lambda/dev-notify-freshservice', '--watch', '--profile', 'amp-dev-peter', '--region', 'eu-west-1']
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_name': '/aws/lambda/dev-notify-freshservice', 'log_stream_name': 'ALL', 'filter_pattern': None, 'watch': True, 'watch_interval': 1, 'output_group_enabled': True, 'output_stream_enabled': True, 'output_timestamp_enabled': False, 'output_ingestion_time_enabled': False, 'start': '5m', 'end': None, 'color': 'auto', 'query': None, 'func': 'list_logs'}
Traceback (most recent call last):
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/awslogs/bin.py", line 175, in main
logs = AWSLogs(**vars(options))
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/awslogs/core.py", line 89, in __init__
self.client = boto3_client(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/awslogs/core.py", line 44, in boto3_client
return session.client(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/boto3/session.py", line 258, in client
return self._session.create_client(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/session.py", line 831, in create_client
client = client_creator.create_client(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/client.py", line 83, in create_client
client_args = self._get_client_args(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/client.py", line 285, in _get_client_args
return args_creator.get_client_args(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/args.py", line 71, in get_client_args
final_args = self.compute_client_args(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/args.py", line 147, in compute_client_args
endpoint_config = self._compute_endpoint_config(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/args.py", line 218, in _compute_endpoint_config
return self._resolve_endpoint(**resolve_endpoint_kwargs)
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/args.py", line 300, in _resolve_endpoint
return endpoint_bridge.resolve(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/client.py", line 360, in resolve
resolved = self.endpoint_resolver.construct_endpoint(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/regions.py", line 133, in construct_endpoint
result = self._endpoint_for_partition(
File "/usr/local/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/regions.py", line 148, in _endpoint_for_partition
raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with awslogs/bin.py for argument parsing and awslogs/core.py at boto3_client, then reproduce the command using --profile and --region. Done means a non-default profile can run awslogs get without the NoRegionError and the existing command behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100