Skip to content

Instantly share code, notes, and snippets.

@shaharke
Created March 15, 2014 17:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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