This builds on the secrets function provided by @bhudgens. We have created a function fromJson that handles extracting one field from a json object, rather than having that functionality directly inside of secrets. This allows us to conveniently request a whole secret, and then assign its components to different env variables.
Usage:
fromJson '{"somekey": "somevalue"}' somekey
# prints somevalue
This is pretty similar to jq, except much less complex/complete, and has no dependencies beyond bash and python
We also wrote a function to get region from instance metadata if it can't be found in env or ~/.aws
Usage:
getRegionFromInstanceMetadata
# prints the region, i.e. us-east-1
This builds on the
secrets
function provided by @bhudgens. We have created a functionfromJson
that handles extracting one field from a json object, rather than having that functionality directly inside ofsecrets
. This allows us to conveniently request a whole secret, and then assign its components to different env variables.Usage:
This is pretty similar to
jq
, except much less complex/complete, and has no dependencies beyond bash and pythonWe also wrote a function to get region from instance metadata if it can't be found in env or ~/.aws
Usage:
So, all together, usage of secrets looks like: