2019/03/21 - Amazon CloudWatch Events - 3 new1 updated api methods
Changes Update events client to latest version
Assigns one or more tags (key-value pairs) to the specified CloudWatch Events resource. Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values. In CloudWatch Events, rules can be tagged.
Tags don't have any semantic meaning to AWS and are interpreted strictly as strings of characters.
You can use the TagResource action with a rule that already has tags. If you specify a new tag key for the rule, this tag is appended to the list of tags associated with the rule. If you specify a tag key that is already associated with the rule, the new tag value that you specify replaces the previous value for that tag.
You can associate as many as 50 tags with a resource.
See also: AWS API Documentation
Request Syntax
client.tag_resource( ResourceARN='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
string
[REQUIRED]
The ARN of the CloudWatch Events rule that you're adding tags to.
list
[REQUIRED]
The list of key-value pairs to associate with the rule.
(dict) --
A key-value pair associated with an AWS resource. In CloudWatch Events, rules support tagging.
Key (string) -- [REQUIRED]
A string you can use to assign a value. The combination of tag keys and values can help you organize and categorize your resources.
Value (string) -- [REQUIRED]
The value for the specified tag key.
dict
Response Syntax
{}
Response Structure
(dict) --
Displays the tags associated with a CloudWatch Events resource. In CloudWatch Events, rules can be tagged.
See also: AWS API Documentation
Request Syntax
client.list_tags_for_resource( ResourceARN='string' )
string
[REQUIRED]
The ARN of the CloudWatch Events rule for which you want to view tags.
dict
Response Syntax
{ 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }
Response Structure
(dict) --
Tags (list) --
The list of tag keys and values associated with the rule you specified
(dict) --
A key-value pair associated with an AWS resource. In CloudWatch Events, rules support tagging.
Key (string) --
A string you can use to assign a value. The combination of tag keys and values can help you organize and categorize your resources.
Value (string) --
The value for the specified tag key.
Removes one or more tags from the specified CloudWatch Events resource. In CloudWatch Events, rules can be tagged.
See also: AWS API Documentation
Request Syntax
client.untag_resource( ResourceARN='string', TagKeys=[ 'string', ] )
string
[REQUIRED]
The ARN of the CloudWatch Events rule from which you are removing tags.
list
[REQUIRED]
The list of tag keys to remove from the resource.
(string) --
dict
Response Syntax
{}
Response Structure
(dict) --
{'Tags': [{'Key': 'string', 'Value': 'string'}]}
Creates or updates the specified rule. Rules are enabled by default, or based on value of the state. You can disable a rule using DisableRule.
If you are updating an existing rule, the rule is replaced with what you specify in this PutRule command. If you omit arguments in PutRule, the old values for those arguments are not kept. Instead, they are replaced with null values.
When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Allow a short period of time for changes to take effect.
A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as on a schedule.
When you initially create a rule, you can optionally assign one or more tags to the rule. Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only rules with certain tag values. To use the PutRule operation and assign tags, you must have both the events:PutRule and events:TagResource permissions.
If you are updating an existing rule, any tags you specify in the PutRule operation are ignored. To update the tags of an existing rule, use TagResource and UntagResource.
Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.
In CloudWatch Events, it is possible to create rules that lead to infinite loops, where a rule is fired repeatedly. For example, a rule might detect that ACLs have changed on an S3 bucket, and trigger software to change them to the desired state. If the rule is not written carefully, the subsequent change to the ACLs fires the rule again, creating an infinite loop.
To prevent this, write the rules so that the triggered actions do not re-fire the same rule. For example, your rule could fire only if ACLs are found to be in a bad state, instead of after any change.
An infinite loop can quickly cause higher than expected charges. We recommend that you use budgeting, which alerts you when charges exceed your specified limit. For more information, see Managing Your Costs with Budgets.
See also: AWS API Documentation
Request Syntax
client.put_rule( Name='string', ScheduleExpression='string', EventPattern='string', State='ENABLED'|'DISABLED', Description='string', RoleArn='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
string
[REQUIRED]
The name of the rule that you are creating or updating.
string
The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)".
string
The event pattern. For more information, see Events and Event Patterns in the Amazon CloudWatch Events User Guide.
string
Indicates whether the rule is enabled or disabled.
string
A description of the rule.
string
The Amazon Resource Name (ARN) of the IAM role associated with the rule.
list
The list of key-value pairs to associate with the rule.
(dict) --
A key-value pair associated with an AWS resource. In CloudWatch Events, rules support tagging.
Key (string) -- [REQUIRED]
A string you can use to assign a value. The combination of tag keys and values can help you organize and categorize your resources.
Value (string) -- [REQUIRED]
The value for the specified tag key.
dict
Response Syntax
{ 'RuleArn': 'string' }
Response Structure
(dict) --
RuleArn (string) --
The Amazon Resource Name (ARN) of the rule.