compwright/aws-env

从AWS SSM安全地加载环境变量

v2.0.0 2024-01-06 15:59 UTC

This package is auto-updated.

Last update: 2024-09-06 17:19:52 UTC


README

命令行脚本,用于从AWS SSM安全地获取服务配置环境和秘密。

配置

配置可以通过命令行选项或环境变量提供

此脚本可以按常规方式找到AWS凭证,包括

  1. 如果在EC2上运行,则通过假设IAM角色(推荐)
  2. 通过读取~/.aws/config~/.aws/credentials文件,可选的AWS_PROFILE环境变量
  3. 显式地使用环境变量AWS_REGIONAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY

用法

Usage:
  aws-env [options]

Options:
  -p, --path=PATH       Parameter key path [default: "/"]
  -f, --format=FORMAT   Output format: dotenv, env, export [default: "env"]
  -h, --help            Display help for the given command. When no command is given display help for the bin/aws-env command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

例如,要启动一个包含从AWS SSM拉取的项目和$PATH的新环境变量的shell

env -i -S"$(bin/aws-env -p /my_app/development) PATH=$PATH" && /bin/bash

许可证

MIT许可证