Can't create environment file with aws secretsmanager command

14 views Asked by At

I am trying to run the following command on an EC2 instance I manage.

sudo aws secretsmanager get-secret-value --secret-id "KingsKidzApplication-env" --region "ap-southeast-2" | jq -r '.SecretString' | jq -r "to_entries|map(\"\(.key)=\\\"\(.value|tostring)\\\"\")|.[]" > "/srv/kingskidz/.env"

However I get the message -bash: /srv/kingskidz/.env: Permission denied

It does not create the .env file. What am I doing wrong here? I have sudo writes for the server. I have given the ec2 AMI role the full permission for secret manager.

enter image description here

0

There are 0 answers