Skip to content

Instantly share code, notes, and snippets.

@shaharke
Created March 15, 2014 17:12
Show Gist options
  • Save shaharke/9570637 to your computer and use it in GitHub Desktop.
Save shaharke/9570637 to your computer and use it in GitHub Desktop.
Protecting your production EC2 instanced from termination with Ansible
---
- hosts: all
tasks:
- name: Gather EC2 facts
action: ec2_facts
- name: Turning on termination protection
local_action: command aws ec2 modify-instance-attribute --region {{ ansible_ec2_placement_region }} --instance-id {{ ansible_ec2_instance_id }} --attribute disableApiTermination --value true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment