Search code examples
node.jsamazon-ec2environment-variables

How to store environment variables on AWS EC2?


I'm using dotenv to fetch and use environment variables from a .env file in my node app while running it locally. But this .env file can't be committed to github for security reasons. I'm using codepipeline and codedeploy to deploy the app continuously to ec2 but then the environment variables are missing on the ec2 instance server. How do I configure the environment variables for my node.js app in AWS EC2 (ubuntu AMI) ?


Solution

  • The best secure way is to use AWS system Manager

    Rerference:

    https://aws.amazon.com/blogs/mt/use-parameter-store-to-securely-access-secrets-and-config-data-in-aws-codedeploy/

    Its secure and fully compatible with codedeploy