1
votes

I am trying to store a new Secret in AWS Secrets Manager using AWS CLI.

On console i get an option to create a Other type of secrets under Select secret type where i choose a plaintext type under Specify the key/value pairs to be stored in this secret.

I want to do that using CLI. Below is the format to use the CLI Command

aws secretsmanager create-secret
--name <value>
[--client-request-token <value>]
[--description <value>]
[--kms-key-id <value>]
[--secret-binary <value>]
[--secret-string <value>]
[--tags <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
1
For 'Other type of secret', just create the secret normally with the cli command you have there. You won't see a behavior change in the console. - committedandroider

1 Answers

5
votes

You can use the --secret-string option for this.

For Key-Value pairs you can do JSON formatted string and it will show up as Key-Value pairs in console:

aws secretsmanager create-secret --name my-secret-kv-pairs --secret-string '{"foo":"bar"}'

If you just want plain text you can do :

aws secretsmanager create-secret --name my-secret-just-text --secret-string 'My random string'