Skip to content

Instantly share code, notes, and snippets.

@naavveenn
Created June 22, 2018 01:47
Show Gist options
  • Save naavveenn/01e5d9a3358738c1ec150bafbbe0c58b to your computer and use it in GitHub Desktop.
Save naavveenn/01e5d9a3358738c1ec150bafbbe0c58b to your computer and use it in GitHub Desktop.
---
- hosts: local
connection: local
vars_files:
- /home/ansible/tbb_awscreds.yml
tasks:
- name: Create a Basic CPU Alarm
ec2_metric_alarm:
aws_access_key: "{{ aws_id }}"
aws_secret_key: "{{ aws_key }}"
region: "{{ aws_region }}"
state: present
name: "msp-ecs-{{ item }}-CPUUtilization-Critical (MSP)"
metric: "CPUUtilization"
namespace: "AWS/ECS"
statistic: Average
comparison: ">="
threshold: 90.0
period: 300
evaluation_periods: 1
unit: "Percent"
description: "This alarm triggers when CPU is greater than 90% for 5 minutes"
dimensions: {'ClusterName': "{{ cluster }}"}
alarm_actions: ['arn:aws:sns:ap-south-1:652024084351:TataSkyBB-MSP-Alerts']
@naavveenn
Copy link
Author

ansible-playbook ecs.yml --extra-vars "cluster=prod-cluster"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment