Deciding on what environments to create for a serverless team
I seen a Twitter poll last week asking the question: Where are we with code environments in 2022? This is something which seems like it should be standardised but never really has become so.
Environments have multiple distinguishing attributes: long-lived or transient; shared or individual; production or not.
When it comes to serverless apps, new environment creation is much cheaper since services are pay-per-use and IaC tooling makes it easy to spin up a set of resources in a stack.
Here are the environments I set up for clients as part of my Serverless Launchpad service:
-
Personal development cloud environment:
- Owned by a single developer
- All WIP feature development and testing work is done here before merging to main
- Hosted in a shared
dev
AWS account which all developers on the team have PowerUser access to - Developer deploys directly to AWS using the Serverless Framework CLI
- The developer’s initials (or another suitable unique short string) is used as the
stage
deployment argument which isolates developers’ stacks from each other’s. Crucially, there is nodev
stage.
-
Test environment:
- Also hosted in the shared
dev
AWS account - Deployed to from CI/CD pipeline after merge to main
- Used only for purposes of CI automated tests and not any manual human testing
stage
=test
- Also hosted in the shared
-
Staging environment:
- Hosted in the
staging
AWS account which developers have restricted access to - Deployed to from CI/CD pipeline after Test stage tests pass
- Can be used for manual human testing in addition to automated CI tests
stage
=staging
- Hosted in the
-
Production environment:
- Hosted in the
prod
AWS account which developers have restricted access to - Deployed to from CI/CD pipeline after Staging stage tests pass (or upon merge to
production
Git branch if team chooses to do human-gated deployments) stage
=prod
- Hosted in the
I typically don’t have a “local” environment for any backend serverless dev work (e.g. using cloud service emulators such as those in LocalStack). However, when I’m occasionally doing frontend web work, I do run it on localhost which is configured to talk to the cloud resources hosted in my personal dev cloud environment (API endpoint, Cognito user pool, etc).
What environments do you use for your teams building serverless apps?
Paul Swail
Indie Cloud Consultant helping small teams learn and build with serverless.
Learn more how I can help you here.
Join daily email list
I publish short emails like this on building software with serverless on a daily-ish basis. They’re casual, easy to digest, and sometimes thought-provoking. If daily is too much, you can also join my less frequent newsletter to get updates on new longer-form articles.