• Documentation
  • Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
Serverless Framework Logo

Serverless Framework

Intro
SetupUpgrading To V4ConceptsTutorialAWS CredentialsLicense KeysVerifying Downloads
DeployingPackagingBuildingTestingDev ModeServicesFunctions
OverviewHTTP (API Gateway v2)REST (API Gateway v1)ActiveMQApplication Load BalancerAlexa SkillAlexa Smart HomeCloudWatch EventCloudWatch LogCloudFrontCognito User PoolEventBridge EventIoTIoT Fleet ProvisioningKafkaKinesis & DynamoDBMSKRabbitMQS3ScheduleSNSSQSWebsocket
Layers
OverviewTroubleshooting
Managed InstancesWeb Apps (Lambda Web Functions)Sandboxes (Lambda MicroVMs)MCP ServersAlertsVersion PruningDomainsIAM Function PermissionsParameters
OverviewSelf-reference serverless.ymlServerless CoreEnvironment VariablesCLI OptionsExternal YAML/JSON FilesJavascript propertiesGitDoppler
OverviewS3 ObjectsSSM Parameter Store & Secrets ManagerCloudFormation Stack Outputs
OverviewVaultTerraform State Output
ResourcesComposing ServicesDeployment BucketStateAgent SkillsPython support
OverviewRuntimeGatewayMemoryBrowserCode InterpreterDev Mode
API Gateway Proxy
OverviewGeneral ConfigurationAuthenticationAPI KeysData SourcesResolversPipeline FunctionsSubstitutionsCachingDelta SyncCustom DomainWAFCLI Commands
Deploying SAM/CFN TemplatesWorkflow Tips
OverviewCreating PluginsCLI OutputCustom CommandsCustom VariablesExtending the Configuration schemaExtending and overriding configuration
OverviewDashboardAxiom
Overviewagent docsagent inspectagent setupagent skills installagent skills list / readdeploydeploy functiondeploy listdevdiffinfoinvokeinvoke localloginlogin awslogin aws ssologsmetricspackageplugin installplugin uninstallprintprunereconcileremoverollbackrollback functionusage
OverviewConcepts
OverviewMetricsTracesTroubleshoot
OverviewNode.jsPython
OutputsProviders
OverviewBranch DeploymentsPreview DeploymentsCustom ScriptsTestingPrivate PackagesNotificationsMono ReposDeploy in your own CI/CDBest PracticesTroubleshootingFAQ
OverviewSetupToolsAWS Integration
Serverless.yml Reference
Examples and TutorialsConfiguration Validation
  1. Usage
  2. Workflow Tips

Development Workflow

This page describes a workflow that keeps the feedback loop short while you build a Serverless Framework service on AWS Lambda: each developer works in a personal stage, edits code against real AWS events with Dev Mode, and lets CI/CD deploy the shared stages. It ends with a cheat sheet of the commands each step uses.

The loop on a personal stage named after you looks like this:

serverless deploy --stage alice
serverless dev --stage alice
serverless deploy --stage alice
serverless remove --stage alice

Deploy the stage once, run Dev Mode while you change handler code, deploy again after you change serverless.yml, and remove the stage when you no longer need it.

Give each developer a stage

A stage is a separate deployment of the same service: its own CloudFormation stack, functions and resources, named after the stage (my-service-alice). The stage comes from --stage, else provider.stage, else dev.

  • Use a personal stage per developer (--stage alice), so one person's deploys and Dev Mode sessions never change another's functions.
  • Keep shared stages such as staging and prod for CI/CD.
  • Put stages that hold production data in a separate AWS account from development stages (AWS Credentials).
  • Set stage-specific values under stages.<stage>.params and read them with ${param:…} (Parameters), instead of branching on the stage name in code.

Develop against real events with Dev Mode

Dev Mode (serverless dev) runs the Node.js (including TypeScript) and Python functions of a deployed stage on your machine. Real invocations of the stage, such as API requests, queue messages and direct invokes, run the code in your working copy, with the deployed function's environment variables and IAM role. Save a file and the next invocation runs it, with no redeploy. When you stop the session with Ctrl+C, q or serverless dev stop, the functions return to their deployed configuration. A session that crashed, was killed or was stopped with a second Ctrl+C leaves functions attached, running their deployed code, until serverless dev restore, the next serverless dev or a deploy restores them (Stop a session and recover functions).

serverless dev --stage alice
  • Dev Mode refuses the prod and production stages; use it on a personal or development stage.
  • A stage that was never deployed is deployed first.
  • Functions in other runtimes, container image functions and Lambda@Edge functions keep running their deployed code.
  • Scripts and AI coding agents run a session in the background with serverless dev --detach and stop it with serverless dev stop (serverless dev).

Deploy changes

Choose the deploy command by what changed:

  • After a change to serverless.yml (functions, events, resources, IAM, settings), run serverless deploy --stage alice. It deploys the whole service through CloudFormation, and skips the deployment when nothing changed.
  • To push one function's code and configuration without CloudFormation, run serverless deploy function -f hello --stage alice. It doesn't deploy events or resources, leaves the function out of sync with the stack, and a later serverless deploy doesn't undo a configuration change it made. Use it on personal stages only (serverless deploy function).

To see what a deploy would change first, run serverless diff --stage alice (serverless diff).

Test and debug a deployed function

Invoke a function in AWS and print its log output:

serverless invoke -f hello --stage alice --log

Follow a function's logs in a separate terminal while you send requests:

serverless logs -f hello --stage alice --tail

Write unit tests for handler logic that run locally without AWS, and keep tests that need AWS resources for a deployed stage (Testing).

Deploy shared stages from CI/CD

Let a pipeline deploy staging and prod, so every change to those stages comes from version control:

serverless deploy --stage prod --region us-east-1

In the pipeline:

  • Authenticate the CLI with a secret in SERVERLESS_ACCESS_KEY (an Access Key) or SERVERLESS_LICENSE_KEY (License Keys). Without a terminal, the CLI doesn't prompt you to sign in: when the CLI finds no credential (no key variable, no serverless login session, no licenseKey, no saved key and no License Key in the /serverless-framework/license-key SSM parameter), the command stops with an error that names the keys to set.
  • Give the pipeline AWS credentials for the stage's account, for example through your CI provider's OpenID Connect integration or environment variables (AWS Credentials).
  • Pin the Framework version with frameworkVersion in serverless.yml, so the pipeline and developers deploy with the same CLI.

Split larger projects into services

Keep each service small enough to deploy quickly and to reason about:

  • Split an application into several services, each with its own serverless.yml, around a data model or a workflow.
  • Keep long-lived resources such as databases and queues in their own services, deployed less often than the code that uses them.
  • Deploy related services together, and pass outputs between them, with Serverless Compose.

Clean up personal stages

Remove a stage you no longer use, so it stops running and costing money:

serverless remove --stage alice

Warning: serverless remove deletes the stage's CloudFormation stack, including its functions and every resource defined in the service, such as tables and buckets. Check the stage name before you run it.

CloudFormation keeps a resource with a DeletionPolicy of Retain, and by default takes a final snapshot of an AWS::RDS::DBCluster and of an AWS::RDS::DBInstance without DBClusterIdentifier before deleting it (DeletionPolicy attribute). Retained resources and snapshots stay in the account and keep incurring charges until you delete them, so check for them after the stack is removed.

CloudFormation deletes an S3 bucket only when it is empty, and serverless remove empties only the service's files in the deployment bucket. When a bucket defined in resources still holds objects, CloudFormation can't delete it, so the stack deletion stops and the stack is left in the DELETE_FAILED state; a bucket with DeletionPolicy: Retain is kept instead and doesn't stop the deletion. Check the stack's events in the CloudFormation console to find the resource that couldn't be deleted. If it's a bucket, empty only that bucket, including every object version and delete marker in a versioned bucket (Emptying a general purpose bucket), then run serverless remove again.

Command cheat sheet

TaskCommand
Create a service from a templateserverless
Deploy the whole serviceserverless deploy --stage STAGE --region REGION
Deploy with detailed progressserverless deploy --stage STAGE --verbose
Deploy one function's code and settingsserverless deploy function -f FUNCTION --stage STAGE
Run the stage's functions locallyserverless dev --stage STAGE
Invoke a deployed function and print logsserverless invoke -f FUNCTION --stage STAGE --log
Follow a function's logsserverless logs -f FUNCTION --stage STAGE --tail
Show the stage's endpoints and outputsserverless info --stage STAGE
Remove the stageserverless remove --stage STAGE

Replace STAGE, REGION and FUNCTION with your stage, AWS Region and the function's key under functions in serverless.yml. -s, -r and -f are the short forms of --stage, --region and --function; -v prints the CLI version, not verbose output.

Related pages

  • Dev Mode: run a deployed stage's functions on your machine.
  • Deploying to AWS: how serverless deploy works.
  • Parameters: stage-specific values.
  • Serverless Compose: deploy several services together.
Edit this page
Prev Deploying SAM/CFN TemplatesNextOverview

Contents

  • Development Workflow
  • Give each developer a stage
  • Develop against real events with Dev Mode
  • Deploy changes
  • Test and debug a deployed function
  • Deploy shared stages from CI/CD
  • Split larger projects into services
  • Clean up personal stages
  • Command cheat sheet
  • Related pages

Related

GuidesPluginsExamplesSlack CommunitySupport