Skip to main content

One-time migration tool to convert a single AWS credentials setup into a multi-environment aws-envs structure

Project description

aws-envs

Manage multiple AWS organizations cleanly by organizing credentials into separate environments.

Problem Statement

Managing AWS profiles across multiple organizations is risky and confusing:

  • Which profile belongs to which organization?
  • Easy to run a command against the wrong account
  • All credentials in a single ~/.aws/credentials file is hard to reason about

Solution: Environments

aws-envs introduces the concept of an environment — a named directory that holds the config and credentials files for one AWS organization. Only one environment is active at a time.

~/.aws/aws-envs/
  my-org-1/
    config
    credentials
  my-org-2/
    config
    credentials

~/.aws/config and ~/.aws/credentials are symlinks pointing to the active environment's files. Switching environments updates those symlinks (or the AWS_CONFIG_FILE / AWS_SHARED_CREDENTIALS_FILE environment variables).

Within an environment you still use standard AWS profilesase selects the environment, asp selects the profile within it.

Key Concepts

Term Meaning
environment A directory under ~/.aws/aws-envs/, typically one per AWS organization
profile A named set of credentials/config within an environment (standard AWS concept)
ase Shell function to switch environments (sets AWS_ENV, updates symlinks/vars)
asp Shell function to switch profiles within the active environment (sets AWS_PROFILE)

Usage

# Switch to an environment
ase my-org-1

# Or pick interactively
ase
# 1 my-org-1    2 my-org-2
# Enter environment number [1-2]> _

# Switch profile within the active environment
asp dev-account

# Or pick interactively
asp
# 1 dev-account    2 prod-account    3 sandbox
# Enter profile number [1-3]> _

# Create a new empty environment
ase --init new-org

The ase and asp shell functions are provided by the oh-my-easytocloud plugin for oh-my-zsh. See that repo for installation and prompt integration.

Initial Setup

If you currently have a standard ~/.aws/credentials and ~/.aws/config (a single-environment setup), run the one-time migration tool to convert it into an aws-envs structure:

uvx aws-envs-setup

No installation required — uvx runs it directly. The tool will:

  1. Ask you to name your first environment (e.g. the AWS organization it represents)
  2. Move your existing ~/.aws/config and ~/.aws/credentials into ~/.aws/aws-envs/<name>/
  3. Create symlinks from ~/.aws/config and ~/.aws/credentials back to the active environment
  4. Write ~/.awsdefaultenv so your shell picks up the right environment on login

After setup, install oh-my-easytocloud to get the ase and asp shell functions.

File Structure After Setup

~/.aws/
  config           -> aws-envs/my-org-1/config   (symlink)
  credentials      -> aws-envs/my-org-1/credentials (symlink)
  aws-envs/
    my-org-1/
      config
      credentials
~/.awsdefaultenv   (contains: my-org-1)
~/.awsdefaultprofile (optional, contains default profile name)

Adding More Environments

ase --init my-org-2
aws configure --profile my-first-account

Tips

  • Use aws configure as normal — it writes to whichever environment is currently active
  • aws sso login works per-environment; CLI v2 SSO is fully supported
  • Consider sso-tools for SSO-specific helpers
  • A prompt that shows the active environment and profile prevents costly mistakes — oh-my-easytocloud provides this out of the box

Legacy

This project supersedes aws-profile-organizer. The underlying ~/.aws/aws-envs/ directory structure is identical — no migration needed if you used aws-profile-organizer before.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_envs_setup-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_envs_setup-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file aws_envs_setup-0.1.0.tar.gz.

File metadata

  • Download URL: aws_envs_setup-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aws_envs_setup-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d5cf6e097e86991056fbb7cd871e3001d77e95c7b978f2f8bc122c4c56b9de5
MD5 c476c6e63f18587c40e2985b5ed8db01
BLAKE2b-256 79ec9eb4f6baf902023abc037d4b8424fea425e98014628d4a1f213d76eb8d47

See more details on using hashes here.

File details

Details for the file aws_envs_setup-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aws_envs_setup-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aws_envs_setup-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f26e500ec62bfbadbaffd8212fba1ca0da8dc3b45b7a3c8117bb5f6d5dfd271e
MD5 2f65209aa1d7486a6191d84fdca3b469
BLAKE2b-256 f9d85235aa202be50980fc31b7203f1b3f69254ff12d7be376638c0641bea58e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page