Photo by stefano stacchini on Unsplash

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

    Architecture & Process Review

    Built a serverless app on AWS, but struggling with performance, maintainability, scalability or DevOps practices?

    I can help by reviewing your codebase, architecture and delivery processes to identify risk areas and their causes. I will then recommend solutions and help you with their implementation.

    Learn more >>

    🪲 Testing Audit

    Are bugs in production slowing you down and killing confidence in your product?

    Get a tailored plan of action for overhauling your AWS serverless app’s tests and empower your team to ship faster with confidence.

    Learn more >>