AWS Secret Manager

Introduction

This guide will show you how to use AWS Secrets Manager to manage configurations via the Configu interface. Learn about the concept of stores.

Working with the store

CLI installation

Linux
MacOs
Windows
1curl https://cli.configu.com/install.sh | sh

CLI usage

Create the store URI as follows:

aws-secrets-manager://[accessKeyId]@[region][?secretAccessKey=][&endpoint=]

Environment variables:

  • AWS_ACCESS_KEY_ID: Specifies an AWS access key associated with an IAM user or role.
  • AWS_SECRET_ACCESS_KEY: Specifies the secret key associated with the access key. This is essentially the "password" for the access key.
  • AWS_REGION: The AWS SDK compatible environment variable that specifies the AWS Region to send the request to.

CLI Upsert

configu upsert --set "example" --schema "example.cfgu.json" --store "aws-secrets-manager:// accessKeyId@region?secretAccessKey=key" --config "FOO=value" --config "BAR=bar"

CLI Export

configu export --set "example" --schema "example.cfgu.json" --store "aws-secrets-manager:// accessKeyId@region?secretAccessKey=key" --format "Dotenv"

CLI Delete

configu delete --set "example" --schema "example.cfgu.json" --store --store "aws-secrets-manager:// accessKeyId@region?secretAccessKey=key"

SDK installation

Install the node.js SDK

// * Using yarn
yarn add @configu/node
// * Using npm
npm install --save @configu/node

SDK usage

import { Cfgu, Set, UpsertCommand, EvalCommand, DeleteCommand, AwsSecretsManagerStore} from "@configu/node";
import path from "path";

const store = new AwsSecretsManagerStore({ credentials: { accessKeyId, secretAccessKey}, region });
const schema = new Cfgu(path.resolve(__dirname, "./example.cfgu.json"));
const set = new Set("dev");

// * Example upsert command
await new UpsertCommand({ store, set, schema, configs: [{ key: "foo", value: "bar" }] }).run();

// * Example eval command
const configs = await new EvalCommand({ store, set, schema }).run();

// * Example delete command
await new DeleteCommand({ store, set, schema }).run();

References

To reference a value from this store, use the following reference format:

{{aws-secrets-manager://<region>@[set/]<schema>[.key][?key=[key]]}}

Example:

{{aws-secrets-manager://us-east-1@example-set/example-schema.foo}}