cloudformation-cli icon indicating copy to clipboard operation
cloudformation-cli copied to clipboard

cfn CLI needs a way to specify --profile

Open vinayagg opened this issue 4 years ago • 2 comments

We use a lot of profiles (multiple gov profiles, seller profiles, commercial profiles etc.)

Since cfn command can only use default profile, we have to manually edit credentials file to switch between profiles. This makes it hard to automate testing and publishing. This also makes it hard to test multiple things

Ability to specify profile will be very helpful. AWS Cli also provides following argument --profile (string) Use a specific profile from your credential file.

vinayagg avatar Jun 03 '21 17:06 vinayagg

This is definitely kind of a dealbreaker and I'm surprised it didn't make it in there. It needs kind of a specific set of permissions like creating KMS keys, roles..etc. So it would be nice to have the option to choose a role that had those privileges.

scottstaffiere avatar Sep 03 '21 19:09 scottstaffiere

i have something similar to the following in my shell rc file

# requires fzf - https://github.com/junegunn/fzf
set-aws-profile() {
    query="${@:-""}"
    unset AWS_ACCESS_KEY_ID
    unset AWS_SECRET_ACCESS_KEY
    unset AWS_DEFAULT_REGION
    export AWS_PROFILE="$(aws configure list-profiles | fzf -1 -q ${query})"
    export AWS_DEFAULT_REGION="$(aws configure get region --profile=${AWS_PROFILE})"
    # aws sts get-caller-identity >/dev/null 2>&1 || aws sso login # might be useful if using sso
}
set-aws-region() {
    query="${@:-""}"
    export AWS_DEFAULT_REGION="$(aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text | fzf -1 -q ${query})"
}

stuart-warren avatar Nov 19 '21 10:11 stuart-warren