Ad

Where To Store API Keys For React/Node App In Aws Ec2 Instance?

I have a react/node application in an ec2 ubuntu instance(sitting at /home/ubuntu/app-name). It's consistently deployed using AWS Cloud deploy and Bitbucket pipelines. I have some API KEYS that I need to use in the application, but I do not want to store them in my repo. Where can I keep these keys and fetch when I need them?

Ad

Answer

For your use case I would recommend the AWS EC2 Parameter Store. Launch the EC2 instance with an instance profile that permits access to the credentials in the Parameter Store and fetch the keys using the AWS SDK of the language of your choice, or using the AWS CLI (e.g. when bootstrapping the instance in the instance user data).

See https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html for more information.

Ad
source: stackoverflow.com
Ad