Search code examples
node.jsweb-push

How to generate vapid-keys for server?


I am trying to generate vapid key

npm install web-push -g
web-push generate-vapid-keys --json

Above method can be used for local development, as i get the keys using web-push generate-vapid-keys --json. What i dont understand is how to generate vapid keys once i deploy my nodejs app to aws? I have not deployed any app to aws or cloud before. I have a devops guy who will help me with this but i need to guide him to generate vapid keys for our server. If i use the same keys which i got when i ran web-push generate-vapid-keys --json on my desktop will they work for prod as well if i shut down my pc?


Solution

  • If i use the same keys which i got when i ran web-push generate-vapid-keys --json on my desktop will they work for prod as well if i shut down my pc?

    Yes, it does not matter where you generate your VAPID keys. You can generate the key pair on your desktop and deploy the application with the keys to your AWS compute instance.