Package: goss-config-gen
Gossamer/AWS Alias GeneratorGeneratesGossamerand AWS aliases
based on a single configuration file.RequirementsPython 2.7 or 3.6It is recommended that you usevirtualenvwrapperto separate
your Python environments.GossamerInstallationInstall the latest release ofGossamerMake sure the path that you saved Gossamer to is in your$PATH.Linux/Mac:Add to your.bashrc(Linux) or.bash_profile(Mac):export PATH=$PATH:<add the path to the folder containing the Gossamer binary>Windows:https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/Install goss-config-genpip install goss-config-genAdd the following to the bottom of your.bash_profile:# Generated aliases
if [ -f $HOME/gossamer/goss-generated-aliases.sh ]; then
    . $HOME/gossamer/goss-generated-aliases.sh
fiConfigurationThe configuration file can be specified manually as an argument--config-fileor-c, or it can be set using theGOSS_GEN_CONFIGenvironment variable. It defaults to$HOME/goss-config.json. This is wheregoss-config-genby
default expects the configuration file to be stored. Asample configuration fileis available
to get you started. Customize the values as appropriate.OutputDirectoryOutput directory that files will be written to.This argument is optional and defaults to$HOME/gossamer.OutputFileOutput file that will contain all the generated aliasesThis argument is optional and defaults togoss-generated-aliases.sh.RoleAliasesMapping of aliases to roles.This argument is optional and allows for the creation of an alias that maps to one or more roles."RoleAliases":{"all":["path/role1","path/role2]}For instance, if you are trying to assume rolespath/role1andpath/role2in all accounts using the above
configuration, the generated alias would begoss-all. In addition to these aliases, by default, an alias for each
normalized version (/'s are replaced with-'s) of a role name will be created.GossamerPathPath to the Gossamer executable. Defaults to/usr/local/bin/gossamerAWSCredentialsPathPath to the AWS credentials file. Defaults to$HOME/.aws/credentialsAWSCLIPathPath to the AWS CLI executable. Defaults to/usr/local/bin/awsBaseProfileBase profile that has credentials from which roles can be assumed. This profile should already be configured in your
AWS credentials file. Defaults to "default".AccountsList of objects contining information about accounts. This argument isrequired.Below is an overview of the fields supported by each object.FieldDescriptionRequiredDefaultsIdAccount IDYesNameAccount NameYesAliasString to use in the generated alias (i.e. if this isr1, the generated alias will begoss-r1)NoValue of the "Name" fieldRegionAWS regionYesRoleRole name, including path, to assumeYesUsageRungoss-config-gen:goss-config-genRestart your terminalUse one of the generated aliases. For example, if one of yourAlias's is set toa, an alias namedgoss-awould be generated. The alias can be used as follows:goss-a [enter your MFA code here]Importing existing role filesIf you already have a number of gossamer role files, you can generated agoss-config-genconfiguration file by
passing those role files intogoss-config-gen.For example, if you have the following role files:role-file-1{"Roles":[{"AccountName":"acct-a","Region":"us-east-1","RoleArn":"arn:aws:iam::123456789012:role/path/role1"},{"AccountName":"acct-b","Region":"us-east-1","Role":"arn:aws:iam::987654321098:role/path/role1"}]}role-file-2{"Roles":[{"AccountName":"acct-c","Region":"us-east-1","Role":"arn:aws:iam::123456789012:role/cs/role2"},{"AccountName":"acct-d","Region":"us-east-1","Role":"arn:aws:iam::111111111111:role/cs/role2"}]}Run the following command to generate the config file:goss-config-gen \
    --config-file <path-where-config-file-will-be-saved> \
    --import-file <path-to-role-file-1> \
    --import-file <path-to-role-file-2>Note: The--config-fileargument is optional and only needed if the config file should be saved to a custom location.It will generate the following configuration file that can be used for subsequent{"Accounts":[{"Id":"123456789012","Name":"acct-a","Region":"us-east-1","Role":"path/role1"},{"Id":"987654321098","Name":"acct-b","Region":"us-east-1","Role":"path/role1"},{"Id":"123456789012","Name":"acct-c","Region":"us-east-1","Role":"path/role2"},{"Id":"111111111111","Name":"acct-d","Region":"us-east-1","Role":"path/role2"}]}Now to generate the aliases with the new configuration file, simply rungoss-config-genas normal:goss-config-gen --config-file <path-to-config-file>Note: Again, the--config-fileargument is optional and only needed if the config file is stored in a custom location.SampleThesample configuration filewill generate the following aliases:goss-a
goss-b
goss-c
goss-d
goss-e
goss-acct-f

aws-a
aws-b
aws-c
aws-d
aws-e
aws-acct-f

awsi-a
awsi-b
awsi-c
awsi-d
awsi-e
awsi-acct-f