Skip to main content

Fetch SSM parameters and add them to .env file

Project description

ssmtoenv - SSM Parameter to .env File Utility

ssmtoenv is a command-line utility that allows you to fetch AWS Systems Manager (SSM) parameters and add them to a .env file. This tool is designed to simplify the process of retrieving and managing sensitive configuration parameters from AWS SSM Parameter Store and making them available for your applications in a local environment.

Usage

ssmtoenv --aws-access-key <AWS_ACCESS_KEY> --aws-secret-key <AWS_SECRET_KEY> [--session-token <SESSION_TOKEN>] [--prefix <PREFIX>] [--install-completion <SHELL>] [--show-completion <SHELL>] [--help]

Options

  • --aws-access-key TEXT: AWS Access Key (required).
  • --aws-secret-key TEXT: AWS Secret Key (required).
  • --session-token TEXT: AWS Session Token (optional, defaults to "None").
  • --prefix TEXT: SSM Parameter Store prefix (optional, defaults to "/cloudflaretunnel/").
  • --install-completion [bash|zsh|fish|powershell|pwsh]: Install completion for the specified shell.
  • --show-completion [bash|zsh|fish|powershell|pwsh]: Show completion for the specified shell, to copy it or customize the installation.
  • --help: Show this message and exit.

How It Works

ssmtoenv interacts with AWS Systems Manager Parameter Store to retrieve configuration parameters based on the provided options. It then generates or updates a .env file with the retrieved parameters, making them available for your application to consume.

Installation

You can install ssmtoenv using pip, the Python package manager:

pip install ssmtoenv

Example

Suppose you have AWS SSM parameters with the prefix /myapp/ containing database credentials, and you want to add them to a .env file for your application to use. You can use the following command:

ssmtoenv --aws-access-key <YOUR_AWS_ACCESS_KEY> --aws-secret-key <YOUR_AWS_SECRET_KEY> --prefix /myapp/

This command will fetch all parameters under the /myapp/ prefix and update your .env file with the retrieved values.

Contributing

If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.


Note: This README provides a brief overview of the ssmtoenv utility. For more detailed information, options, and usage examples, please refer to the command-line help (ssmtoenv --help) or the source code documentation.

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

ssmtoenv-0.1.4.1.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

ssmtoenv-0.1.4.1-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

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