npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aws-profile-prompt

v0.11.0

Published

Allows easy management of AWS Profiles with search.

Downloads

16

Readme

AWS Profile Prompt

Allows easy management of AWS Profiles with search.

Demo

Installation

npm i -g aws-profile-prompt 

Alias _awsp by adding the following to your .bashrc or .zshrc. This must be done to ensure the AWS_PROFILE environment variable is exported correctly.

alias awsp="source _awsp"

Usage

awsp

# Or, to default the filter (e.g. To list the environments containing "prod"): 
awsp prod

ZSH Prompt

In the recording, my zsh prompt shows the active AWS Profile. My .zshrc is as follows:

function aws_prof {   
  if [ "$AWS_PROFILE"  = '' ]; then
    true
  else
     echo "%{$fg_bold[blue]%}aws:(%{$fg[red]%}$AWS_PROFILE%{$fg_bold[blue]%})%{$reset_color%} "
  fi
}

PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(aws_prof)$(git_prompt_info)'

Profile Configuration

Note: This section is only relevant if you are new to AWS Profiles.

AWS Profiles are created in ~/.aws/credentials.

[a]
aws_access_key_id=XXX
aws_secret_access_key=xxx

[b]
aws_access_key_id=XXX
aws_secret_access_key=xxx

I make heavy use of AWS organizations or sub-accounts. For example, AWS account 'a' would have region/environment sub-accounts 'a.au.prod' and 'a.fr.prod'. I assume a role to jump from the main account into these sub-accounts.

In this example, my ~/.aws/credentials would contain:

# Profile name
[a.au.prod]

# The role that you are assuming. The role specified when creating the sub-account will work.
role_arn = arn:aws:iam::[sub-account-id]:role/OrganizationAccountAccessRole

# The default region for the profile.
region = ap-southeast-2

# The source profile to use the access keys from.
source_profile = a

You can switch between profiles by setting the AWS_PROFILE environment variable to the name of the profile.

Using Profiles with the AWS Javascript SDK V3

It is possible to split AWS configuration into 'credentials' and 'config'.

  • ~/.aws/credentials stores profiles with an access key and secret (e.g. '[a]')
  • ~/.aws/config stores profiles with a source_profile (e.g. '[a.au.prod]')

This works fine with the AWS CLI, but it does not work with V3 of the Javascript SDK right now. All profiles MUST be defined in ~/.aws/credentials. Otherwise, the current version of the AWS SDK will fail to find the profile (Yes, even if AWS_SDK_LOAD_CONFIG is set).

This is the primary motivation behind this package. Other profile switches use ~/.aws/config to source profile configuration which make them useless when used alongside the V3 SDK.