Skip to content
Latchkey

serverless deploy Command Reference

Package and deploy a Serverless Framework service to a stage.

serverless deploy provisions or updates the CloudFormation stack for your service: functions, events, and resources defined in serverless.yml. In CI you target a stage explicitly.

What it does

serverless deploy packages your functions, uploads artifacts, and deploys the generated CloudFormation stack for the chosen stage and region. It creates the stack on first run and updates it on subsequent deploys.

Common flags and usage

  • --stage STAGE: target stage (dev, staging, prod)
  • --region REGION: target AWS region
  • --verbose: stream detailed CloudFormation progress
  • --function NAME: deploy a single function quickly (code only)
  • --conceal: hide secrets from deploy output
  • --force: deploy even when no changes are detected

Example

shell
- name: Serverless Deploy
  env:
    SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
    AWS_REGION: us-east-1
  run: npx serverless deploy --stage prod --region us-east-1 --verbose

In CI

Pass --stage explicitly so deploys never default to the wrong environment. Authenticate to AWS via OIDC and supply SERVERLESS_ACCESS_KEY from secrets for Serverless Framework dashboard features. serverless deploy is non-interactive by default, so it is CI-safe without extra flags.

Key takeaways

  • serverless deploy provisions or updates the service CloudFormation stack.
  • Always set --stage and --region so deploys hit the intended environment.
  • Use OIDC for AWS creds and SERVERLESS_ACCESS_KEY from secrets for dashboard auth.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →