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 sso-start-url information to profile name process input #118

Open
eriweb opened this issue Mar 18, 2024 · 2 comments
Open

Add sso-start-url information to profile name process input #118

eriweb opened this issue Mar 18, 2024 · 2 comments

Comments

@eriweb
Copy link

eriweb commented Mar 18, 2024

I've got multiple aws organizations and identity centers, and to make matters worse the same account names in them all.

Would it be possible to add information about sso url to the profile name process? that way i could customize the naming and take sso url into consideration

@iainelder
Copy link

You can use the components option to customize the profile name format.

There is no dynamic component for instance-level attributes, but you can use a literal to name each instance.

I work with Identity Center instances for OrgA and OrgB.

OrgA and OrgB each have two accounts called Name1 and Name2. I can assume 1 role in each account.

Today I handle it by using a different command for each instance to populate the profiles.

aws-sso-util configure populate \
--sso-start-url "..." \
--sso-region "..." \
--region "..." \
--components "OrgA,account_name,account_id,role_name"
 
aws-sso-util configure populate \
--sso-start-url "..." \
--sso-region "..." \
--region "..." \
--components "OrgB,account_name,account_id,role_name" 
  • OrgA/OrgB: literal to name the Identity Center instance
  • account_name, account_id, role_name: dynamic components

That generates a list of profiles like this:

OrgA.Name1.111111111111.Role1
OrgA.Name2.222222222222.Role1
OrgB.Name1.333333333333.Role1
OrgB.Name2.444444444444.Role1

You can distinguish the two "Name1" accounts by the different prefixes "OrgA" and "OrgB".

I like to include the account ID in the profile name for extra clarity.

Such a long name may be awkward to type. To avoid that I run the aws configure list-profiles command, copy the profile I need from the output, and paste it where I need it.

@benkehoe
Copy link
Owner

benkehoe commented May 26, 2024

Sorry for the very long delay (and it will be a while longer as I get spun back up on my projects). This is a good idea and I will add it. However, I believe you can accomplish this today by adding the start URL to the command you're giving to --profile-name-process, e.g.

aws-sso-util configure populate --sso-start-url $AWS_SSO_START_URL ... --profile-name-process "my_profile_process $AWS_SSO_START_URL"

Note to self: add a note to the docs that arguments may get added over time (but will never get reduced or rearranged), so process formatters should not rely on a specific number of total arguments, as in unpacking sys.argv[:7] rather than sys.argv

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

No branches or pull requests

3 participants