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

Added module to display current aws profile #26

Merged
merged 1 commit into from
Feb 8, 2021
Merged

Added module to display current aws profile #26

merged 1 commit into from
Feb 8, 2021

Conversation

alastair-smith
Copy link
Contributor

New Module

Added a module that displays the current value of the AWS_PROFILE environment variable which is used to distinguish which account to use when working with amazon web services command line tools.

Why

I find that when I am working with tools to interact with Amazon Web Services via the command line I am constantly switching accounts as I have various work/personal accounts to manage. It can be annoying constantly checking which account I am currently interacting with, so I have added it to this great PS1.

Background

AWS is a cloud platform with over 1 million customers [1] and is used by developers all over the world to run their code. Developers can interact with AWS via command line interface, sdks, and tools like terraform and packer.

When you want to interact with multiple AWS accounts via one machine you need to configure the command line by running configure commands, for example aws configure --profile dev and aws configure --profile prod. Then you can specify which account you want to interact with in that shell session by running export AWS_PROFILE=dev or export AWS_PROFILE=prod. This should help prevent deploying dev resources in a prod environment.

I have not added support for the default profile that is selected when the AWS_PROFILE environment variable has not been set. Instead I have opted to hide the module. This is because I do not have a default account set as it is more likely to lead to running things in the incorrect account, I believe this is best practice. (If someone only has one account then using the default is fine, but I doubt they'd need their PS1 to statically tell them they are on the default).

See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html for official information about how the profiles work.

Added a module that displays the current value of the AWS_PROFILE environment variable which is used to distinguish which account to use when working with amazon web services command line tools.
@chris-marsh
Copy link
Owner

Thanks for contributing the AWS module and my apologies for not replying for so long .. I've been busy elsewhere.

I'll review the changes and see how we go. My immediate thought is I don't want to keep adding modules as they contribute complexity and size - all potentially slowing the prompt down as the code is run every-time it appears. But ... I agree with the 'why' and appreciate the thought that has gone into it.

@darkvertex
Copy link
Contributor

> My immediate thought is I don't want to keep adding modules as they contribute complexity and size - all potentially slowing the prompt down as the code is run every-time it appears.

@chris-marsh Have you considered shuffling some stuff around so we can add "custom modules" into a subfolder and call them from our own .pureline.conf file? That might relieve the burden of not wanting to merge features into the core while still letting people release their own additions to the pureline experience.

@chris-marsh chris-marsh merged commit e102730 into chris-marsh:master Feb 8, 2021
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.

3 participants