boto3_cloudwatch_alarm¶
Manage CloudWatch alarms using boto3.¶
Renamed from
boto_cloudwatch_alarmtoboto3_cloudwatch_alarmand updated to call the refactoredboto3_cloudwatch_alarmexecution module.
Create and destroy CloudWatch alarms. Be aware that this interacts with Amazon’s services, and so may incur charges.
- depends:
boto3 >= 1.28.0
botocore >= 1.31.0
This module uses boto3, which can be installed via package, or pip.
This module accepts explicit CloudWatch credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
If IAM roles are not used you need to specify them either in the minion’s config file or as a profile. For example, to specify them in the minion’s config file:
cloudwatch.keyid: GKTADJGHEIQSXMKKRBJ08H
cloudwatch.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
It’s also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
my test alarm:
boto3_cloudwatch_alarm.present:
- name: my test alarm
- attributes:
MetricName: ApproximateNumberOfMessagesVisible
Namespace: AWS/SQS
Statistic: Average
ComparisonOperator: GreaterThanOrEqualToThreshold
Threshold: 20000.0
Period: 60
EvaluationPeriods: 1
AlarmDescription: test alarm via salt
Dimensions:
- Name: QueueName
Value: the-sqs-queue-name
AlarmActions:
- arn:aws:sns:us-east-1:1111111:myalerting-action
Added in version 1.0.0.
- saltext.boto3.states.boto3_cloudwatch_alarm.__virtual__()[source]¶
Only load if the boto3_cloudwatch execution module is available.
- saltext.boto3.states.boto3_cloudwatch_alarm.present(name, attributes, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure the cloudwatch alarm exists.
- name
Name of the alarm.
- attributes
A dict of boto3 CloudWatch alarm attributes (
MetricName,Namespace,Statistic,ComparisonOperator,Threshold,Period,EvaluationPeriods,Unit,AlarmDescription,Dimensions,AlarmActions,InsufficientDataActions,OKActions).- region
Region to connect to.
- key
Secret key to be used.
- keyid
Access key to be used.
- profile
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-present: boto3_cloudwatch_alarm.present: - name: example
- saltext.boto3.states.boto3_cloudwatch_alarm.absent(name, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure the named cloudwatch alarm is deleted.
- name
Name of the alarm.
- region
Region to connect to.
- key
Secret key to be used.
- keyid
Access key to be used.
- profile
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-absent: boto3_cloudwatch_alarm.absent: - name: example