Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use profile if set, remove default #172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions awscurl/awscurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,10 @@ def load_aws_config(access_key, secret_key, security_token, credentials_path, pr

if botocore:
import botocore.session
session = botocore.session.get_session()
if profile:
session = botocore.session.Session(profile=profile)
else:
session = botocore.session.get_session()
cred = session.get_credentials()
access_key, secret_key, security_token = cred.access_key, cred.secret_key, cred.token

Expand Down Expand Up @@ -461,7 +464,7 @@ def inner_main(argv):

parser.add_argument('--region', help='AWS region', default='us-east-1',
env_var='AWS_DEFAULT_REGION')
parser.add_argument('--profile', help='AWS profile', default='default', env_var='AWS_PROFILE')
parser.add_argument('--profile', help='AWS profile', env_var='AWS_PROFILE')
parser.add_argument('--service', help='AWS service', default='execute-api')
parser.add_argument('--access_key', env_var='AWS_ACCESS_KEY_ID')
parser.add_argument('--secret_key', env_var='AWS_SECRET_ACCESS_KEY')
Expand Down