OscarCLI is a command-line tool for managing AWS Secrets Manager secrets. It allows you to create, update, and retrieve secrets, as well as generate API keys. It is also used to write secrets to a .env file for use in local development.
- If Go is already installed, run the following command to install OscarCLI:
go install github.com/AndrewCMonson/oscarcli@latest
-
If Go is not installed, go to the Releases Page.
- Download the binary for your operating system:
- Linux:
oscarcli-linux - MacOS:
oscarcli-darwin - Windows:
oscarcli-windows.exe
- Linux:
- Download the binary for your operating system:
-
Move the binary to a directory in your
PATHand make it executable:- Linux/MacOS:
mv oscarcli-linux /usr/local/bin/oscarcli chmod +x /usr/local/bin/oscarcli
- Windows:
Rename
oscarcli-windows.exetooscarcli.exeand move it toC:\Windows\System32.
- Linux/MacOS:
-
Verify the installation by running
oscarcli --version or oscarcli -v.
- You must have configured AWS credentials on your machine. You can do this by running
aws configureand following the prompts. - As of version 1.2.4, OscarCLI uses the credentials for AWS of the user running the command. This means that the user must have the necessary permissions to create, update, and retrieve secrets in AWS Secrets Manager.
- When using the
env-getcommand, the.envfile will be created in the current working directory. If the file already exists, it will be overwritten. - When using the
env-setcommand, the.envfile will be read from the specified path. If the file does not exist, an error will be thrown.
-
env-get: Retrieve a secret from AWS Secrets Manager and write it to a .env file.oscarcli env <secret-name> <region>
-
env-set: Write a .env file to AWS Secrets Manager.oscarcli env-set <secret-name> <region> <env-file-path>
-
env-create: Create a new AWS Secret and populate it with a .env file's contents.oscarcli env-create <secret-name> <region> <env-file-path>
-
create: Create a new secret in AWS Secrets Manager.oscarcli create <secret-name> <region> <key> <value>
-
update: Update an existing secret in AWS Secrets Manager.oscarcli update <secret-name> <region> <key> <value>
-
apikey: Will either create or update a secret value as an api-key. If given the create argument, it will create a new AWS secret and then populate a key:value pair with the api-key-name and generated api-key based on the provided key name and length. If given the update argument, it will update an existing secret with the api-key-name and generated api-key based on the provided key name and length.oscarcli apikey <action> <secret-name> <region> <api-key-name> <key-length(int)>
-
Create a new secret:
oscarcli create my-secret us-east-1 my-key my-value
-
Update an existing secret:
oscarcli update my-secret us-east-1 my-key new-value
-
Retrieve a secret and write it to a .env file:
oscarcli env-get my-secret us-east-1
-
Write a .env file to AWS Secrets Manager:
oscarcli env-set my-secret us-east-1 /path/to/.env
-
Create a new secret and populate it with a .env file's contents:
oscarcli env-create my-secret us-east-1 /path/to/.env
-
Generate a new API key:
oscarcli apikey update my-secret us-east-1 my-api-key 32
This project is licensed under the MIT License.