Creating secrets using the AWS CLI

You can also create secrets via the AWS CLI by using the aws secretsmanager create-secret command:

> aws secretsmanager create-secret --name test/credentials --kms-key-id alias/secrets-key \
--secret-string '{"MYSQL_PASSWORD":"some-super-secret-password"}'
{
"ARN": "arn:aws:secretsmanager:us-east-1:385605022855:secret:test/credentials-l3JdTI",
"Name": "test/credentials",
"VersionId": "beab75bd-e9bc-4ac8-913e-aca26f6e3940"
}
Creating a Secret Using the AWS CLI

In the preceding example, notice that you specify the secret string as a JSON object, which provides the key/value format you saw earlier.