Edit a notification rule
You can edit a notification rule to change its name, the events for which it sends notifications, the detail type, or the target or targets to which it sends notifications. You can use the Developer Tools console or the AWS CLI to edit a notification rule.
To edit a notification rule (console)
Open the AWS Developer Tools console at https://console.aws.amazon.com/codesuite/settings/notifications
. -
In the navigation bar, expand Settings, and then choose Notification rules.
-
In Notification rules, review the rules configured for resources in your AWS account in the AWS Region where you are currently signed in. Use the selector to change the AWS Region.
-
Choose the rule from the list, and then choose Edit. Make your changes, and then choose Submit.
To edit a notification rule (AWS CLI)
-
At a terminal or command prompt, run the describe-notification-rule command to view the structure of the notification rule.
-
Run the update-notification rule command to generate the JSON skeleton and then save it to a file.
aws codestar-notifications update-notification-rule --generate-cli-skeleton >
update.json
You can name the file anything you want. In this example, the file is
update.json
. -
Open the JSON file in a plaintext editor and make changes to the rule.
The following example shows a notification rule named
MyNotificationRule
for a repository namedMyDemoRepo
in an AWS account with the ID123456789012
. Notifications are sent to an Amazon SNS topic namedMyNotificationTopic
when branches and tags are created. The rule name is changed toMyNewNotificationRule
.{ "Name": "
MyNewNotificationRule
", "EventTypeIds": [ "codecommit-repository-branches-and-tags-created" ], "Resource": "arn:aws:codecommit:us-east-1
:123456789012
:MyDemoRepo
", "Targets": [ { "TargetType": "SNS", "TargetAddress": "arn:aws:sns:us-east-1
:123456789012
:MyNotificationTopic
" } ], "Status": "ENABLED", "DetailType": "FULL" }Save the file.
-
Using the file you just edited, at the terminal or command line, run the update-notification-rule command again to update the notification rule.
aws codestar-notifications update-notification-rule --cli-input-json file://
update
.json -
If successful, the command returns the Amazon Resource Name (ARN) of the notification rule, similar to the following.
{ "Arn": "arn:aws:codestar-notifications:
us-east-1
:123456789012
:notificationrule/dc82df7a-EXAMPLE" }
To remove a tag from a notification rule (AWS CLI)
-
At a terminal or command prompt, run the untag-resource command. For example, the following command removes a tag with the name of
Team
.aws codestar-notifications untag-resource --arn arn:aws:codestar-notifications:us-east-1:123456789012:notificationrule/fe1efd35-EXAMPLE --tag-keys Team
-
If successful, this command returns nothing.