Project

General

Profile

Actions

Feature #48

open
AS

Feature #33: Canofy Control Centre Backend Development

Feature #46: Canofy Control Centre Onboarding Process

# [CANOFY-102] Enable EC2 Termination Protection

Feature #48: # [CANOFY-102] Enable EC2 Termination Protection

Added by Akshath Shettigara about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/23/2026
Due date:
% Done:

0%

Estimated time:

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_id in the pipeline context.

Acceptance Criteria

  • DisableApiTermination is true on the instance immediately after
    this stage runs.
  • Stage fails clearly if instance_id is 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

Actions

Also available in: PDF Atom