Skip to content

fac/aws_local_config_parser

Repository files navigation

AwsLocalConfigParser

Parse your local "$HOME"/.aws/config to use it within a Ruby script.

Up and Running

  1. Checkout this repo: gh repo clone fac/aws_local_config_parser
  2. Run: bin/setup
  3. Run: bin/demo

Usage

See demo for examples on how to use the gem.

Supports parsing and returning:

  • Profiles with SSO
  • Profiles with Access Key + Secret
  • SSO Sessions
require 'aws_local_config_parser'

config = AwsLocalConfigParser.new

# Profile with SSO
my_sso_profile = config.profile('my-sso-profile-name')
my_sso_profile.sso_session
my_sso_profile.sso_account_id
my_sso_profile.sso_role_name
my_sso_profile.region

## Profile with Access Key + Secret
non_sso_profile = config.profile('my-non-sso-profile-name')
non_sso_profile.aws_access_key_id
non_sso_profile.aws_secret_access_key
non_sso_profile.region

## SSO Session
my_sso_session = config.sso_session('sso-session')
my_sso_session.sso_start_url
my_sso_session.sso_registration_scopes
my_sso_session.sso_region

## Listing all names
config.all_profiles
config.all_sso_sessions

Making a commit

Lefthook has been configured with pre-commit checks to:

  • run rubocop for any ruby files
  • run actionlint for any GitHub workflow files

If for some reason it's necessary, it's possible to temporarily skip lefthook with: LEFTHOOK=0 git commit.

Create a new release

Following Sematic Versioning, bump the version:

  1. gem bump --version "<sem_ver_bump>" and merge the changes to main
  2. The Release and Build Gem wokflow will trigger a new version build
  3. Manually create a new release:
    1. Click on Draft a new release
    2. In the Choose a tag dropdown, selecting the new version
    3. Click Generate release notes and review the notes
    4. Ensure Set as the latest release is checked
    5. Click Publish release