Serverless Tip #2: Use ephemeral environments to supercharge your developer experience
One of the benefits of the pay-as-you-go serverless pricing model is the possibility of using ephemeral environments.
When using managed services like DynamoDB and EventBridge, testing in the cloud is a lot simpler than replicating said services locally.
Shared, long-lived development and staging environments will reduce developer productivity. Developers will block each other while waiting for the development environment to be free. There is also a high probability of conflicts with data, dependencies, and configuration of the managed services.
With ephemeral environments, each developer gets a production-like environment. They get their own DynamoDB tables, EventBridge buses, Lambda functions, etc. One developer’s experiment will no longer interfere with another developer’s work.
For each pull request, you can hook up your CI pipeline to deploy to an ephemeral stack. You then have a pristine production-like environment, which you can seed and run tests against. When you merge the pull request, the pipeline can tear down the stack again.
Why do ephemeral environments and serverless fit so well together?
By using true serverless services with a pay-as-you-go pricing model, each ephemeral environment will only cost you pennies. igger for your function instead of API Gateway. Such a change should only require changes to the handler code, not the business logic.