

# Getting started with notifications
<a name="getting-started"></a>

The easiest way to get started with notifications is to set up a notification rule on one of your build projects, deployment applications, pipelines, or repositories.

**Note**  
The first time you create a notification rule, a service-linked role is created in your account. For more information, see [Using service-linked roles for AWS CodeStar Notifications](using-service-linked-roles.md).

**Topics**
+ [Prerequisites](#getting-started-prerequisites)
+ [Create a notification rule for a repository](getting-started-repository.md)
+ [Create a notification rule for a build project](getting-started-build.md)
+ [Create a notification rule for a deployment application](getting-started-deploy.md)
+ [Create a notification rule for a pipeline](getting-started-pipeline.md)

## Prerequisites
<a name="getting-started-prerequisites"></a>

Complete the steps in [Setting up](setting-up.md). You also need a resource for which you create a notification rule.
+ [Create a build project in CodeBuild](https://docs.aws.amazon.com/codebuild/latest/userguide/create-project.html) or use an existing one.
+ [Create an application](https://docs.aws.amazon.com/codedeploy/latest/userguide/applications-create.html) or use an existing deployment application.
+ [Create a pipeline in CodePipeline](https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create.html) or use an existing one.
+ [Create an AWS CodeCommit repository](https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-repository.html) or use an existing one.

# Create a notification rule for a repository
<a name="getting-started-repository"></a>

You can create notification rules to send notifications about repository events that are important to you. The following steps show you how to set up a notification rule on a single repository event. These steps are written with the assumption that you have a repository configured in your AWS account.

**Important**  
If you set up notifications in CodeCommit before November 5, 2019, the Amazon SNS topics used for those notifications will contain a policy that allows CodeCommit to publish to it that contains different permissions than those required for AWS CodeStar Notifications. Using these topics is not recommended. If you want to use one created for that experience, you must add the required policy for AWS CodeStar Notifications in addition to the one that already exists. For more information, see [Configure Amazon SNS topics for notifications](set-up-sns.md) and [Understanding notification contents and security](security.md#security-notifications). 

1. Open the CodeCommit console at [https://console.aws.amazon.com/codecommit/](https://console.aws.amazon.com/codecommit/).

1. Choose a repository from the list and open it.

1. Choose **Notify**, and then choose **Create notification rule**. You can also choose **Settings**, choose **Notifications**, and then choose **Create notification rule**.

1. In **Notification name**, enter a name for the rule.

1. In **Detail type**, choose **Basic** if you want only the information provided to Amazon EventBridge included in the notification. Choose **Full** if you want to include information provided to Amazon EventBridge and information that might be supplied by the resource service or the notification manager.

   For more information, see [Understanding notification contents and security](security.md#security-notifications).

1. In **Events that trigger notifications**, under **Branches and tags**, select **Created**.

1. In **Targets**, choose **Create SNS topic**.
**Note**  
When you create the topic as part of creating the notification rule, the policy that allows CodeCommit to publish events to the topic is applied for you. Using a topic created for notification rules helps ensure that you subscribe only those users who you want to receive notifications about this repository.

   After the **codestar-notifications-** prefix,enter a name for the topic, and then choose **Submit**.
**Note**  
If you want to use an existing Amazon SNS topic instead of creating a new one, in **Targets**, choose its ARN. Make sure the topic has the appropriate access policy, and that the subscriber list contains only those users who are allowed to see information about the resource. If the Amazon SNS topic is a topic that was used for CodeCommit notifications before November 5, 2019, it will contain a policy that allows CodeCommit to publish to it that contains different permissions than those required for AWS CodeStar Notifications. Using these topics is not recommended. If you want to use one created for that experience, you must add the required policy for AWS CodeStar Notifications in addition to the one that already exists. For more information, see [Configure Amazon SNS topics for notifications](set-up-sns.md) and [Understanding notification contents and security](security.md#security-notifications). 

1. Choose **Submit**, and then review the notification rule.

1. Subscribe your email address to the Amazon SNS topic you just created. For more information, see [To subscribe users to an Amazon SNS topic used for notifications](subscribe-users-sns.md#set-up-sns-subscribe).

1. Navigate to your repository and create a test branch from the default branch.

1. After you create the branch, the notification rule sends a notification to all topic subscribers with information about that event.

# Create a notification rule for a build project
<a name="getting-started-build"></a>

You can create notification rules to send notifications about the events on your build project that are important to you. The following steps show you how to set up a notification rule on a single build project event. These steps are written with the assumption that you have a build project configured in your AWS account.

1. Open the CodeBuild console at [https://console.aws.amazon.com/codebuild/](https://console.aws.amazon.com/codebuild/).

1. Choose a build project from the list and open it.

1. Choose **Notify**, and then choose **Create notification rule**. You can also choose **Settings**, and then choose **Create notification rule**.

1. In **Notification name**, enter a name for the rule.

1. 

   In **Detail type**, choose **Basic** if you want only the information provided to Amazon EventBridge included in the notification. Choose **Full** if you want to include information provided to Amazon EventBridge and information that might be supplied by the resource service or the notification manager.

   For more information, see [Understanding notification contents and security](security.md#security-notifications).

1.  In **Events that trigger notifications**, under **Build phase**, select **Success**.

1. In **Targets**, choose **Create SNS topic**.
**Note**  
When you create the topic as part of creating the notification rule, the policy that allows CodeBuild to publish events to the topic is applied for you. Using a topic created for notification rules helps ensure that you subscribe only those users you want to receive notifications about this build project.

   After the **codestar-notifications-** prefix, enter a name for the topic, and then choose **Submit**.
**Note**  
If you want to use an existing Amazon SNS topic instead of creating a new one, in **Targets**, choose its ARN. Make sure the topic has the appropriate access policy, and that the subscriber list contains only those users who are allowed to see information about the resource. If the Amazon SNS topic is a topic that was used for CodeCommit notifications before November 5, 2019, it will contain a policy that allows CodeCommit to publish to it that contains different permissions than those required for AWS CodeStar Notifications. Using these topics is not recommended. If you want to use one created for that experience, you must add the required policy for AWS CodeStar Notifications in addition to the one that already exists. For more information, see [Configure Amazon SNS topics for notifications](set-up-sns.md) and [Understanding notification contents and security](security.md#security-notifications). 

1. Choose **Submit**, and then review the notification rule.

1. Subscribe your email address to the Amazon SNS topic you just created. For more information, see [To subscribe users to an Amazon SNS topic used for notifications](subscribe-users-sns.md#set-up-sns-subscribe).

1. Navigate to your build project and start a build.

1. After the build phase is successfully completed, the notification rule sends a notification to all topic subscribers with information about that event.

# Create a notification rule for a deployment application
<a name="getting-started-deploy"></a>

You can create notification rules to send notifications about the events on your deployment application that are important to you. The following steps show you how to set up a notification rule on a single build project event. These steps are written with the assumption that you have a deployment application configured in your AWS account.

1. Open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy/](https://console.aws.amazon.com/codedeploy/).

1. Choose an application from the list and open it.

1. Choose **Notify**, and then choose **Create notification rule**. You can also choose **Settings**, and then choose **Create notification rule**.

1. In **Notification name**, enter a name for the rule.

1. In **Detail type**, choose **Basic** if you want only the information provided to Amazon EventBridge included in the notification. Choose **Full** if you want to include information provided to Amazon EventBridge and information that might be supplied by the resource service or the notification manager.

   For more information, see [Understanding notification contents and security](security.md#security-notifications).

   

1.  In **Events that trigger notifications**, under **Deployment**, select **Succeeded**.

1. In **Targets**, choose **Create SNS topic**.
**Note**  
When you create the topic as part of creating the notification rule, the policy that allows CodeDeploy to publish events to the topic is applied for you. Using a topic created for notification rules helps ensure that you subscribe only those users you want to receive notifications about this deployment application.

   After the **codestar-notifications-** prefix, enter a name for the topic, and then choose **Submit**.
**Note**  
If you want to use an existing Amazon SNS topic instead of creating a new one, in **Targets**, choose its ARN. Make sure the topic has the appropriate access policy, and that the subscriber list contains only those users who are allowed to see information about the resource. If the Amazon SNS topic is a topic that was used for CodeCommit notifications before November 5, 2019, it will contain a policy that allows CodeCommit to publish to it that contains different permissions than those required for AWS CodeStar Notifications. Using these topics is not recommended. If you want to use one created for that experience, you must add the required policy for AWS CodeStar Notifications in addition to the one that already exists. For more information, see [Configure Amazon SNS topics for notifications](set-up-sns.md) and [Understanding notification contents and security](security.md#security-notifications). 

1. Choose **Submit**, and then review the notification rule.

1. Subscribe your email address to the Amazon SNS topic you just created. For more information, see [To subscribe users to an Amazon SNS topic used for notifications](subscribe-users-sns.md#set-up-sns-subscribe).

1. Navigate to your deployment application and start a deployment.

1. After thedeployment succeeds, the notification rule sends a notification to all topic subscribers with information about the event.

# Create a notification rule for a pipeline
<a name="getting-started-pipeline"></a>

You can create notification rules to send notifications about the events on your pipeline that are important to you. The following steps show you how to set up a notification rule on a single pipeline event. These steps are written with the assumption that you have a pipeline configured in your AWS account.

1. Open the CodePipeline console at [https://console.aws.amazon.com/codepipeline/](https://console.aws.amazon.com/codepipeline/).

1. Choose a pipeline from the list and open it.

1. Choose **Notify**, and then choose **Create notification rule**. You can also choose **Settings**, and then choose **Create notification rule**.

1. In **Notification name**, enter a name for the rule.

1. In **Detail type**, choose **Basic** if you want only the information provided to Amazon EventBridge included in the notification. Choose **Full** if you want to include information provided to Amazon EventBridge and information that might be supplied by the resource service or the notification manager.

   For more information, see [Understanding notification contents and security](security.md#security-notifications).

1. In **Events that trigger notifications**, under **Action execution**, select **Started**.

1. In **Targets**, choose **Create SNS topic**.
**Note**  
When you create the topic as part of creating the notification rule, the policy that allows CodePipeline to publish events to the topic is applied for you. Using a topic created for notification rules helps ensure that you subscribe only those users you want to receive notifications about this pipeline.

   After the **codestar-notifications-** prefix,enter a name for the topic, and then choose **Submit**.
**Note**  
If you want to use an existing Amazon SNS topic instead of creating a new one, in **Targets**, choose its ARN. Make sure the topic has the appropriate access policy, and that the subscriber list contains only those users who are allowed to see information about the resource. If the Amazon SNS topic is a topic that was used for CodeCommit notifications before November 5, 2019, it will contain a policy that allows CodeCommit to publish to it that contains different permissions than those required for AWS CodeStar Notifications. Using these topics is not recommended. If you want to use one created for that experience, you must add the required policy for AWS CodeStar Notifications in addition to the one that already exists. For more information, see [Configure Amazon SNS topics for notifications](set-up-sns.md) and [Understanding notification contents and security](security.md#security-notifications). 

1. Choose **Submit**, and then review the notification rule.

1. Subscribe your email address to the Amazon SNS topic you just created. For more information, see [To subscribe users to an Amazon SNS topic used for notifications](subscribe-users-sns.md#set-up-sns-subscribe).

1. Navigate to your pipeline, and then choose **Release change**.

1. When the action starts, the notification rule sends a notification to all topic subscribers with information about the event.