I often find myself creating four separate stages for each ⚡ Serverless Framework project I work on: dev
, staging
, prod
, and local
. Obviously the first three are meant to be deployed to the cloud, but the last one, local
, is meant to run and test interactions with local resources. It’s also great to have an offline version (like when you’re on a plane ✈ or have terrible wifi somewhere). Plus, development is much faster because you’re not waiting for round trips to the server. 😉
A really great feature of Serverless is the ability to configure ENVIRONMENT variables in the serverless.yml
file. This lets us store important global information like database names, service endpoints and more. We can even reference passwords securely using AWS’s Service Manager Parameter Store and decode encrypted secrets on deployment, keeping them safe from developers and source repositories alike. 😬 Just reference the variable with ${ssm:/myapp/my-secure-value~true}
in your configuration file.