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 no dev 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
  • 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
  • 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

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?

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.

    View Emails Archive

    ☎️ Serverless Clarity Call

    Need quick guidance on a specific issue on your AWS serverless project? Or just wondering where to start with serverless?

    Book a call and ask me anything.

    Learn more >>

    🛫 Serverless Launchpad

    Ready to start building your new AWS serverless project but need help with getting everything setup?

    The Serverless Launchpad is a done-for-you DevOps service installed in under a week. You get a leading-practice multi-account AWS environment, a scaffolded codebase and architecture including the common AWS serverless services, isolated cloud environments for individual developers, automated delivery pipelines right through to production and much more. Everything is IaC, extensively documented and handed over to your developers.

    Learn more >>