Feature #48
openFeature #33: Canofy Control Centre Backend Development
Feature #46: Canofy Control Centre Onboarding Process
# [CANOFY-102] Enable EC2 Termination Protection
0%
Description
[CANOFY-102] Enable EC2 Termination Protection¶
Type: Story
Epic: New Client Onboarding — Automated AWS + Frappe Provisioning
Stage key: termination_protection (pipeline stage 2 of 15)
Component: utils/aws_client.py
User Story¶
As an operations engineer,
I want every newly provisioned client instance protected against
accidental termination,
so that a stray terminate-instances call (console misclick, script
bug, bulk cleanup) can't destroy a live client's server.
Description¶
Immediately after the instance is running, enable
DisableApiTermination on it via ModifyInstanceAttribute. This must run
early in the pipeline — before any destructive-capable stage — so that even
if a later stage fails badly, the instance itself is safe from accidental
deletion.
Note the trade-off this creates deliberately: if onboarding fails
downstream and the instance needs to be discarded, an engineer must
explicitly disable termination protection first. This is intentional — see
Test Case TC-3.
Configuration / Prerequisites¶
- Depends on stage 1 (
aws_provision) having produced a valid
instance_idin the pipeline context.
Acceptance Criteria¶
-
DisableApiTerminationistrueon the instance immediately after
this stage runs. -
Stage fails clearly if
instance_idis missing from context (defensive
check — should never happen if stage ordering is correct, but must not
silently no-op).
Test Cases¶
| ID | Scenario | Steps | Expected Result |
|---|---|---|---|
| TC-1 | Happy path | Run stage against a freshly provisioned instance |
describe-instance-attribute --attribute disableApiTermination returns true
|
| TC-2 | Termination blocked | Attempt terminate-instances on the protected instance directly via AWS CLI |
Call fails with OperationNotPermitted
|
| TC-3 | Manual override still possible | Explicitly call ModifyInstanceAttribute to disable protection, then terminate |
Termination succeeds — confirms protection is a deliberate, reversible safeguard, not a permanent lock |
No data to display