I have a JSON body that looks something like this.
This was retrieved through AWS cli secrets manager command.
{
"user1": {
"username": "user",
"password": "123",
},
"user2": {
"username": "user2",
"password": "1234"
}
}
I need a command that would put this JSON
into a file called something like user.json
.
Is this possible through a command?
## buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: latest
commands:
- npm install
pre_build:
commands:
- CREDS="$(aws secretsmanager get-secret-value --secret-id arn:aws:secretsmanager:{secret} | jq '.SecretString | fromjson')"
build:
commands:
- echo $CREDS (prints the correct credentials in json format)
- Need to send $CREDS > user.json or something similar. Is this possible?
- npm start test:run