Skip to content

Commit

Permalink
Add aws profile parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
siutsin committed May 21, 2019
1 parent 7b30835 commit 78b90aa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions list_lambdas.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def init_boto_client(client_name, region, args):
aws_secret_access_key=args.token_secret,
region_name=region
)
elif args.profile:
session = boto3.session.Session(profile_name=args.profile)
boto_client = session.client(client_name, region_name=region)
else:
boto_client = boto3.client(client_name, region_name=region)

Expand Down Expand Up @@ -278,6 +281,15 @@ def print_lambda_list(args):
default='region',
metavar='sort_by'
)
parser.add_argument(
'--profile',
type=str,
help=(
'AWS profile. Optional '
'(default: "default" from local configuration).'
),
metavar='profile'
)

arguments = parser.parse_args()
if arguments.sort_by not in SORT_KEYS:
Expand Down

0 comments on commit 78b90aa

Please sign in to comment.