Retrieves plain-text values from AWS Secrets Manager. Single binary, no dependencies
1.7K
Retrieves an AWS secret value as-is after given its secret name. The script can read an AWS Profile name as well as a credentials file in the CLI, otherwise it will automatically load its settings following AWS SDK standards
> get-aws-secret-value
Help:
-aws-region string
AWS Region where to send requests to (default "default")
-credentials-file string
Full path to credentials file (default "/root/.aws/credentials")
-profile string
AWS Profile to use (default "default")
-secret-name string
Secret To Fetch (default "secret")
-secret-version string
Version of secret To Fetch (default "version")
Using go get:
go get -u github.com/kitos9112/get-aws-secret-value
Or download the binary from the releases page.
# Linux
curl -L https://github.com/kitos9112/get-aws-secret-value/releases/download/0.1.131/get-aws-secret-value_0.1.131_linux_x86_64.tar.gz | tar xz
# OS X
curl -L https://github.com/kitos9112/get-aws-secret-value/releases/download/0.1.131/get-aws-secret-value_0.1.131_osx_x86_64.tar.gz | tar xz
# Windows
curl -LO https://github.com/kitos9112/get-aws-secret-value/releases/download/0.1.131/get-aws-secret-value_0.1.131_windows_x86_64.zip
unzip get-aws-secret-value_0.1.131_windows_x86_64.zip
get-aws-secret-value [OPTIONS] [COMMAND [ARGS...]]
/bin/sh: get-aws-secret-value: not found
The simplest example that could easily be integrated into a CICD pipeline:
> export AWS_PROFILE=myAwsProfile
> export AWS_REGION=eu-west-1
> get-aws-secret-value --secret-name my_secret_name
mySecretValue
Or in case you leverage IaC within your favourite public cloud using Terragrunt, you could retrieve the value of an AWS secret previously created and pre-populated by more complext data structures (e.g. JSON)
# terragrunt.hcl
inputs = {
my_secret_var1 = lookup(jsondecode(run_cmd("--terragrunt-quiet", "/usr/local/bin/aws-get-secret-value", "--secret-name", "my_secret", "--aws-region", "eu-west-1")), "secretKey1")
my_secret_var2 = lookup(jsondecode(run_cmd("--terragrunt-quiet", "/usr/local/bin/aws-get-secret-value", "--secret-name", "my_secret", "--aws-region", "eu-west-1")), "secretKey2")
}
As you can see, a simple cross-platform binary file could be utilised in many scenarios that aid when retrieving an AWS secret value.
Content type
Image
Digest
Size
7.7 MB
Last updated
about 5 years ago
docker pull kitos9112/get-aws-secret-value