IaC integreren in CI/CD-pijplijnen

Deployments automatiseren op AWS

Dunieski Otano

Amazon Web Services Solutions Architect

Eerst code, later infrastructuur

code-first

  • Code wordt gedeployd via CodePipeline; infrastructuur handmatig
  • Devs schalen Lambda; ops vergroot de SQS-queue
  • Drift tussen code en infra veroorzaakt uitval
  • Koppel CloudFormation in dezelfde pijplijn
Deployments automatiseren op AWS

CloudFormation als pijplijnactie

pipeline-action

  • CodePipeline ondersteunt een CloudFormation deploy-actie
  • De pijplijn geeft een template-artifact door aan de actie
  • Modi: CREATE_UPDATE, DELETE_ONLY, REPLACE_ON_FAILURE, CHANGE_SET_REPLACE / EXECUTE
  • Draait naast source-, build- en app-deploy-acties
Deployments automatiseren op AWS

Een typische end-to-end pijplijn

typical

  • Source: Git-push triggert de pijplijn
  • Build: maak een template + app-artifact
  • Infra deployen: CloudFormation maakt of werkt de stack bij
  • App deployen: CodeDeploy levert de nieuwe versie
Deployments automatiseren op AWS

Automatische rollback bij stack-fout

  • Mislukte updates rollen automatisch terug naar de laatste goede staat
  • De pijplijnfase faalt en stopt latere fasen
  • Failure-alerts uit Hoofdstuk 1 gaan automatisch af

automatic

Deployments automatiseren op AWS

Nested stacks voor modulaire templates

  • Een nested stack is van het type AWS::CloudFormation::Stack
  • Breek een template van 2.000 regels op in herbruikbare modules
  • Parent-stack geeft parameters door en leest outputs
  • Elke module deployt zelfstandig binnen de parent

nested

Deployments automatiseren op AWS

StackSets voor multi-account, multi-regio

  • Een StackSet deployt één template naar veel accounts en regio's
  • Handig voor security-baselines, guardrails, gedeelde infra
  • Voeg stack-instances toe of verwijder ze zonder de template te herschrijven
  • Centraal beheerd, lokaal gedeployd

stackset

Deployments automatiseren op AWS

De juiste vorm kiezen

right-shape

  • Single stack: kleine app, één omgeving
  • Nested stacks: grote template, modulaire componenten
  • StackSets: zelfde template, veel accounts en regio's
  • Alle drie werken goed met CodePipeline
Deployments automatiseren op AWS

Laten we oefenen!

Deployments automatiseren op AWS

Preparing Video For Download...