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

Add support for --profile for selecting IAM credentials #131

Merged
merged 2 commits into from
Sep 20, 2017
Merged

Add support for --profile for selecting IAM credentials #131

merged 2 commits into from
Sep 20, 2017

Conversation

doIIarplus
Copy link
Contributor

Related Issue: #27

Adds --profile as a new flag for start-api and invoke to allow user to specify specific profiles if needed, instead of always using the default profile

@resios
Copy link
Contributor

resios commented Sep 20, 2017

Why not set the AWS_PROFILE environment variable as instructed by: http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default

This way no change to aws-sam-local is required.

@sanathkr
Copy link
Contributor

--profile is also the standard AWS CLI way of specifying profile. Tools other than AWS CLI that source creds have generally exposed this flag to customers in addition to AWS_PROFILE. It is a good to have

@@ -108,6 +108,10 @@ func main() {
Usage: "Optional. Specify whether SAM should skip pulling down the latest Docker image. Default is false.",
EnvVar: "SAM_SKIP_PULL_IMAGE",
},
cli.StringFlag{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes for future: common options like profile must be abstracted into an args object and passed down to Invoke/StartApi for processing.

Copy link
Contributor

@sanathkr sanathkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing it!

@sanathkr sanathkr merged commit b3101e5 into aws:develop Sep 20, 2017
@cam8001
Copy link

cam8001 commented Apr 25, 2019

Is this flag in the current version of sam-cli? It doesn't seem to show up in 0.15 from Brew:

$ sam --version                                                                                                                                                                
SAM CLI, version 0.15.0

$ sam --profile datalake                                                                                                                                                        
Error: no such option: --profile

@Zanndorin
Copy link

@cam8001 It is but at the end of the command
sam local start-api --profile devAdmin

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-invoke.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants