0Pricing
Serverless Backend with AWS Lambda & API Gateway · Aula

Implantações seguras com canário e reversão

Implante alterações sem servidor sem indisponibilidade. Aprenda sobre aliases do Lambda, mudança de tráfego ponderada, implantações canário com o CodeDeploy e reversão automática ao receber alertas.

Implantações seguras com canário e reversão é uma aula grátis de Serverless Backend with AWS Lambda & API Gateway no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Serverless Backend with AWS Lambda & API Gateway, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Serverless Backend with AWS Lambda & API Gateway inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

The Risk of Big-Bang Deploys

Switching all traffic to new code at once means a bug hits every user instantly. Progressive deployments shift traffic gradually so problems surface on a small slice first.

Lambda Versions and Aliases

Publishing a Lambda creates an immutable version. An alias is a pointer (like live) you can move between versions, enabling controlled cutovers.

Weighted Aliases

An alias can split traffic between two versions by weight, sending, say, 10% to the new version and 90% to the old.

aws lambda update-alias \
  --function-name api --name live \
  --function-version 12 \
  --routing-config '{"AdditionalVersionWeights":{"11":0.9}}'

Canary Deployments

A canary sends a small percentage of traffic to the new version, waits, then promotes the rest if healthy. CodeDeploy automates this for Lambda.

Deployment Preferences in SAM

SAM exposes this via DeploymentPreference, choosing a canary or linear pattern.

AutoPublishAlias: live
DeploymentPreference:
  Type: Canary10Percent5Minutes
  Alarms:
    - !Ref ErrorAlarm

Linear Deployments

A linear pattern shifts traffic in equal increments over time (e.g. 10% every minute), giving a slower, steadier rollout than a single canary step.

CloudWatch Alarms as Gates

Attach alarms (error rate, latency) to the deployment. If an alarm fires during the shift, the deployment is considered failed.

Automatic Rollback

When an alarm trips, CodeDeploy automatically moves the alias back to the previous version, restoring known-good code with no manual action.

Pre and Post Traffic Hooks

Lifecycle hook Lambdas run before and after traffic shifts, letting you run smoke tests and abort the deploy if they fail.

Blue/Green vs Canary

Blue/green stands up a full second environment and switches over; canary shifts a percentage within one environment. For Lambda, weighted aliases make canary the simpler, cheaper default.

Best Practices

Deploy safely:

  • Always deploy behind an alias
  • Start with a small canary percentage
  • Gate on meaningful alarms
  • Run smoke tests in pre-traffic hooks

Quick Check

Test your safe-deployment knowledge.

Recap

You learned progressive delivery:

  • Versions are immutable; aliases point to them
  • Weighted aliases and canaries shift traffic gradually
  • SAM DeploymentPreference automates canary/linear patterns
  • Alarms gate the rollout and trigger automatic rollback

Perguntas Frequentes

A aula “Implantações seguras com canário e reversão” é grátis?

Sim — o texto completo de “Implantações seguras com canário e reversão” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Serverless Backend with AWS Lambda & API Gateway, atualize para CoddyKit PRO. O curso de Serverless Backend with AWS Lambda & API Gateway inclui 4 aulas no total.

O que vou aprender em “Implantações seguras com canário e reversão”?

Implante alterações sem servidor sem indisponibilidade. Aprenda sobre aliases do Lambda, mudança de tráfego ponderada, implantações canário com o CodeDeploy e reversão automática ao receber alertas. Você pratica Serverless Backend with AWS Lambda & API Gateway com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Serverless Backend with AWS Lambda & API Gateway?

Nenhuma experiência prévia é necessária. Serverless Backend with AWS Lambda & API Gateway no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Implantações seguras com canário e reversão”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Serverless Backend with AWS Lambda & API Gateway?

Sim. Cada aula de Serverless Backend with AWS Lambda & API Gateway inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. CodeCommit e CodeBuild
  2. CodePipeline para implantações
  3. Automação de implantações sem servidor
  4. Implantações seguras com canário e reversão
← Voltar para Serverless Backend with AWS Lambda & API Gateway