awsdecomhost.py

Full decommission path for an EC2 host: terminate the instance and clean up local operational state that refers to it.

Usage

awsdecomhost.py <name> [--yes] [--region REGION]

Cleanup Performed

Requests EC2 termination when the instance still exists.

Uses the UDP daemon to disable the host entry and save the updated hosts file.

Removes the host from ~/ansible/hosts.ini, prunes SSH known_hosts entries, deletes ~/.ssh/<name>.pem, and calls update_hosts_note.py terminate <name>.

Leaves AWS key-pair deletion as a manual follow-up and prints the corresponding AWS CLI command.

version 1  ·  created 2026-05-12  ·  updated 2026-05-12  ·  tags ['aws', 'ec2', 'decommission']