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.
Installation
Using Go
If Go is already installed, run the following command to install OscarCLI:
go install github.com/AndrewCMonson/oscarcli@latest
Windows:
Rename oscarcli-windows.exe to oscarcli.exe and move it to C:\Windows\System32.
Verify the installation by running oscarcli --version or oscarcli -v.
Usage
You must have configured AWS credentials on your machine. You can do this by running aws configure and 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-get command, the .env file will be created in the current working directory. If the file already exists, it will be overwritten.
When using the env-set command, the .env file will be read from the specified path. If the file does not exist, an error will be thrown.
Commands
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.
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.