Deployment safety and artifact provenance
Build once, promote the same artifact
A release artifact is the exact package or container image intended for deployment. Build from a reviewed commit with pinned dependencies, record the build identity and software bill of materials (SBOM), scan dependencies and store the result in a restricted artifact repository. Promote the same reviewed bytes from test to staging and production rather than rebuilding from a mutable branch. An SHA-256 digest identifies bytes; an expected digest obtained from a trusted source can detect a change. It does not identify who built the artifact. A signature and verified provenance connect the artifact to a trusted signer and build process under an explicit trust policy. A scan result is time-bound and does not prove absence of vulnerabilities.
Protect the pipeline and promotion
ECR supports tag immutability and exclusions; use a digest reference for deployment and review repository settings, retention and image deletion permissions. ECR integrates with AWS Signer for managed or manual image signing. Verify signatures against intended trust policy before admitting an image; a signed image can still contain vulnerabilities. Use distinct build and deploy roles, short-lived credentials and scoped artifact access. CodePipeline manual approvals can pause progression; bind the reviewed release record to the exact digest, change set, environment and evidence. A reviewer must not approve a different artifact accidentally. Never execute arbitrary repository hooks or build scripts from untrusted inputs in a privileged context.
Shift traffic gradually with explicit thresholds
Blue/green keeps old and new environments available for a controlled traffic switch; canary shifts a small fraction first. CodeDeploy supports configured traffic shifts for applicable Lambda and ECS deployment types, hooks, alarms and rollback settings. A fictional policy starts with 10% of traffic and requires at least 100 observed requests. With 1000 canary requests and 30 errors, error rate is 3%, above the 1% limit; halt promotion and evaluate rollback. With 20 requests and zero errors, evidence is insufficient, not safe. Check latency, business invariants and sample duration as well as errors. Blue/green capacity can increase costs; estimate overlapping compute, storage and logs before a real test.
Plan data compatibility before rollout
Use expand-and-contract migrations: first add a compatible field or table, deploy code that can work with both schemas, backfill in bounded batches with verification, and remove old fields only after all readers and rollback requirements are addressed. If a new release writes data an old version cannot understand, switching traffic back is not enough. Keep previous artifacts, configuration and compatible schema available; if data compatibility is unknown, stop new traffic and escalate to the recovery plan rather than forcing rollback. In the lab hash a small original byte sequence, modify it, and reject the altered artifact. Signature and provenance flags are synthetic and not cryptographic verification.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Deployment safety and artifact provenance — knowledge check
Reason about test evidence, safe promotion and recovery.
What distinguishes a digest from a verified signature?
Why promote the same artifact through environments?
1000 requests with 30 errors and a 1% cap should yield what?
What should happen with 20 samples and zero errors under a 100-sample rule?
Why use expand-and-contract migrations?