

# Working with applications in CodeDeploy
<a name="applications"></a>

After you configure instances, but before you can deploy a revision, you must create an application in CodeDeploy. An *application* is simply a name or container used by CodeDeploy to ensure the correct revision, deployment configuration, and deployment group are referenced during a deployment. 

Use the information in the following table for next steps:


| Compute platform | Scenario | Information for next step | 
| --- | --- | --- | 
|  **EC2/On-Premises**  |  I haven't created instances yet.  |  See [Working with instances for CodeDeploy](instances.md), and then return to this page.  | 
|  **EC2/On-Premises**  | I have created instances, but I haven't finished tagging them. |  See [Tagging instances for deployment groups in CodeDeploy](instances-tagging.md), and then return to this page.  | 
|   **EC2/On-Premises**, **AWS Lambda**, and **Amazon ECS**   |  I haven't created an application yet.  |  See [Create an application with CodeDeploy](applications-create.md)   | 
|   **EC2/On-Premises**, **AWS Lambda**, and **Amazon ECS**   |  I have already created an application, but I haven't created a deployment group.  |  See [Create a deployment group with CodeDeploy](deployment-groups-create.md).  | 
|   **EC2/On-Premises**, **AWS Lambda**, and **Amazon ECS**   | I have already created an application and deployment group, but I haven't created an application revision. | See [Working with application revisions for CodeDeploy](application-revisions.md). | 
|   **EC2/On-Premises**, **AWS Lambda**, and **Amazon ECS**   | I have already created an application and deployment group, and I have already uploaded my application revision. I'm ready to deploy. | See [Create a deployment with CodeDeploy](deployments-create.md). | 

**Topics**
+ [Create an application](applications-create.md)
+ [View application details](applications-view-details.md)
+ [

# Create a notification rule
](notification-rule-create.md)
+ [Rename an application](applications-rename.md)
+ [Delete an application](applications-delete.md)

# Create an application with CodeDeploy
<a name="applications-create"></a>

An *application* is simply a name or container used by CodeDeploy to ensure that the correct revision, deployment configuration, and deployment group are referenced during a deployment. You can use the CodeDeploy console, the AWS CLI, the CodeDeploy APIs, or an CloudFormation template to create applications.

Your code, or application revision, is installed to instances through a process called a deployment. CodeDeploy supports two types of deployments: 
+ **In-place deployment**: The application on each instance in the deployment group is stopped, the latest application revision is installed, and the new version of the application is started and validated. You can use a load balancer so that each instance is deregistered during its deployment and then restored to service after the deployment is complete. Only deployments that use the EC2/On-Premises compute platform can use in-place deployments. For more information about in-place deployments, see [Overview of an in-place deployment](welcome.md#welcome-deployment-overview-in-place).
+ **Blue/green deployment**: The behavior of your deployment depends on which compute platform you use:
  + **Blue/green on an EC2/On-Premises compute platform**: The instances in a deployment group (the original environment) are replaced by a different set of instances (the replacement environment) using these steps:
    + Instances are provisioned for the replacement environment.
    + The latest application revision is installed on the replacement instances.
    + An optional wait time occurs for activities such as application testing and system verification.
    + Instances in the replacement environment are registered with one or more Elastic Load Balancing load balancers, causing traffic to be rerouted to them. Instances in the original environment are deregistered and can be terminated or kept running for other uses.
**Note**  
If you use an EC2/On-Premises compute platform, be aware that blue/green deployments work with Amazon EC2 instances only.
  + **Blue/green on an AWS Lambda or Amazon ECS compute platform**: Traffic is shifted in increments according to a **canary**, **linear**, or **all-at-once** deployment configuration.
  + **Blue/green deployments through CloudFormation**: Traffic is shifted from your current resources to your updated resources as part of an CloudFormation stack update. Currently, only ECS blue/green deployments are supported. 

  For more information about blue/green deployments, see [Overview of a blue/green deployment](welcome.md#welcome-deployment-overview-blue-green).

When you use the CodeDeploy console to create an application, you configure its first deployment group at the same time. When you use the AWS CLI to create an application, you create its first deployment group in a separate step.

To view a list of applications already registered to your AWS account, see [View application details with CodeDeploy](applications-view-details.md). For information about using an CloudFormation template to create an application, see [CloudFormation templates for CodeDeploy reference](reference-cloudformation-templates.md).

 Both deployment types do not apply to all destinations. The following table lists which deployment types work with deployments to the three types of deployment destinations.


****  

| Deployment destination | In-place | Blue/green | 
| --- | --- | --- | 
| Amazon EC2  | Yes | Yes | 
| On-premises | Yes | No | 
| Serverless AWS Lambda functions | No | Yes | 
| Amazon ECS applications | No | Yes | 



**Topics**
+ [

# Create an application for an in-place deployment (console)
](applications-create-in-place.md)
+ [

# Create an application for a blue/green deployment (console)
](applications-create-blue-green.md)
+ [

# Create an application for an Amazon ECS service deployment (console)
](applications-create-ecs.md)
+ [

# Create an application for an AWS Lambda function deployment (console)
](applications-create-lambda.md)
+ [

# Create an application (CLI)
](applications-create-cli.md)

# Create an application for an in-place deployment (console)
<a name="applications-create-in-place"></a>

To use the CodeDeploy console to create an application for an in-place deployment:

 

**Warning**  
Do not follow these steps if:  
You have not prepared your instances to be used in CodeDeploy deployments. To set up your instances, follow the instructions in [Working with instances for CodeDeploy](instances.md), and then follow the steps in this topic.
You want to create an application that uses a custom deployment configuration, but you have not yet created the deployment configuration. Follow the instructions in [Create a deployment configuration with CodeDeploy](deployment-configurations-create.md), and then follow the steps in this topic. 
You do not have a service role that trusts CodeDeploy with the minimum required trust and permissions. To create and configure a service role with the required permissions, follow the instructions in [Step 2: Create a service role for CodeDeploy](getting-started-create-service-role.md), and then return to the steps in this topic.
You want to select a Classic Load Balancer, Application Load Balancer, or Network Load Balancer in Elastic Load Balancing for the in-place deployment, but have not yet created it.

To create an application for an in-place deployment using the CodeDeploy console:

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, expand **Deploy**, and then choose **Getting started**.

1. Choose **Create application**.

1. In **Application name**, enter the name of your application .

1. From **Compute Platform**, choose **EC2/On-premises**.

1. Choose **Create application**.

1. On your application page, from the **Deployment groups** tab, choose **Create deployment group**.

1. In **Deployment group name**, enter a name that describes the deployment group.
**Note**  
If you want to use the same settings used in another deployment group (including the deployment group name; tags, Amazon EC2 Auto Scaling group names, or both; and the deployment configuration), specify those settings on this page. Although this new deployment group and the existing deployment group have the same name, CodeDeploy treats them as separate deployment groups, because they are each associated with separate applications.

1. In **Service role**, choose a service role that grants CodeDeploy access to your target instance.

1. In **Deployment type**, choose **In-place**.

1. In **Environment configuration**, select any of the following: 

   1. **Amazon EC2 Auto Scaling groups**: Enter or choose the name of an Amazon EC2 Auto Scaling group to deploy your application revision to. When new Amazon EC2 instances are launched as part of an Amazon EC2 Auto Scaling group, CodeDeploy can deploy your revisions to the new instances automatically. You can add up to 10 Amazon EC2 Auto Scaling groups to a deployment group.

   1. **Amazon EC2 instances** or **On-premises instances**: In the **Key** and **Value** fields, enter the values of the key-value pair you used to tag the instances. You can tag up to 10 key-value pairs in a single tag group.

      1. You can use wildcards in the **Value** field to identify all instances tagged in certain patterns, such as similar Amazon EC2 instance, cost center, and group names, and so on. For example, if you choose **Name** in the **Key** field and enter **GRP-\$1a** in the **Value** field, CodeDeploy identifies all instances that fit that pattern, such as **GRP-1a**, **GRP-2a**, and **GRP-XYZ-a**.

      1. The **Value** field is case sensitive. 

      1. To remove a key-value pair from the list, choose **Remove tag**.

      As CodeDeploy finds instances that match each specified key-value pair or Amazon EC2 Auto Scaling group name, it displays the number of matching instances. Choose the number to see more information about the instances.

      If you want to refine the criteria for the deployed-to instances, choose **Add tag group** to create an tag group. You can create up to three tag groups with up to ten key-value pairs each. When you use multiple tag groups in a deployment group, only instances that are identified by all the tag groups are included in the deployment group. That means an instance must match at least one of the tags in each of the groups to be included in the deployment group.

      For information about using tag groups to refine your deployment group, see [Tagging instances for deployment groups in CodeDeploy](instances-tagging.md).

1. In **Deployment settings**, choose a deployment configuration to control the rate your application is deployed to instances, such as one at a time or all at once. For more information about deployment configurations, see [Working with deployment configurations in CodeDeploy](deployment-configurations.md).

1. (Optional) In **Load balancer**, select **Enable load balancing**, and then from the lists, select the Classic Load Balancers, Application Load Balancer target groups, and Network Load Balancer target groups to manage traffic to the instances during the CodeDeploy deployment. You can select up to 10 Classic Load Balancers and 10 target groups, for a total of 20 items. Make sure that the Amazon EC2 instances that you want to deploy to are registered with the selected load balancers (Classic Load Balancers) or target groups (Application Load Balancers and Network Load Balancers).

   During a deployment, the original instances are deregistered from the selected load balancers and target groups to prevent traffic from being routed to these instances during the deployment. When the deployment is complete, each instance is re-registered with *all* the selected Classic Load Balancers and target groups.

   For more information about load balancers for CodeDeploy deployments, see [Integrating CodeDeploy with Elastic Load Balancing](integrations-aws-elastic-load-balancing.md).

1. (Optional) Expand **Advanced**, and configure any options you want to include in the deployment, such as Amazon SNS notification triggers, Amazon CloudWatch alarms, or automatic rollbacks.

   For more information, see [Configure advanced options for a deployment group](deployment-groups-configure-advanced-options.md). 

1. Choose **Create deployment group**. 

The next step is to prepare a revision to deploy to the application and deployment group. For instructions, see [Working with application revisions for CodeDeploy](application-revisions.md).

# Create an application for a blue/green deployment (console)
<a name="applications-create-blue-green"></a>

To use the CodeDeploy console to create an application for a blue/green deployment:

**Note**  
A deployment to the AWS Lambda compute platform is always a blue/green deployment. You do not specify a deployment type option.

**Warning**  
Do not follow these steps if:  
You do not have instances with the CodeDeploy agent installed that you want to replace during the blue/green deployment process. To set up your instances, follow the instructions in [Working with instances for CodeDeploy](instances.md), and then follow the steps in this topic.
You want to create an application that uses a custom deployment configuration, but you have not yet created the deployment configuration. Follow the instructions in [Create a deployment configuration with CodeDeploy](deployment-configurations-create.md), and then follow the steps in this topic. 
You do not have a service role that trusts CodeDeploy with, at minimum, the trust and permissions described in [Step 2: Create a service role for CodeDeploy](getting-started-create-service-role.md). To create and configure a service role, follow the instructions in [Step 2: Create a service role for CodeDeploy](getting-started-create-service-role.md), and then follow the steps in this topic.
You have not created a Classic Load Balancer, Application Load Balancer, or Network Load Balancer in Elastic Load Balancing for the registration of the instances in your replacement environment. For more information, see [Set up a load balancer in Elastic Load Balancing for CodeDeploy Amazon EC2 deployments](deployment-groups-create-load-balancer.md).

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, expand **Deploy**, and then choose **Getting started**.

1. In **Application name**, enter the name of your application .

1. From **Compute platform**, choose **EC2/On-Premises**.

1. Choose **Create application**.

1. On your application page, from the **Deployment groups** tab, choose **Create deployment group**.

1. In **Deployment group name**, enter a name that describes the deployment group.
**Note**  
If you want to use the same settings used in another deployment group (including the deployment group name tags, Amazon EC2 Auto Scaling group names, and the deployment configuration), choose those settings on this page. Although this new deployment group and the existing deployment group have the same name, CodeDeploy treats them as separate deployment groups, because each is associated with a separate application.

1. In **Service role**, choose a service role that grants CodeDeploy access to your target instance.

1. In **Deployment type** choose **Blue/green**.

1. In **Environment configuration**, choose the method to use to provide instances for your replacement environment:

   1. **Automatically copy Amazon EC2 Auto Scaling group**: CodeDeploy creates an Amazon EC2 Auto Scaling group by copying one you specify.

   1. **Manually provision instances**: You won't specify the instances for your replacement environment until you create a deployment. You must create the instances before you start the deployment. Instead, here you specify the instances you want to replace.

1. Depending on your choice in step 10, do one of the following:
   + If you chose **Automatically copy Amazon EC2 Auto Scaling group**: In **Amazon EC2 Auto Scaling group**, choose or enter the name of the Amazon EC2 Auto Scaling group you want to use as a template for the Amazon EC2 Auto Scaling group for the instances in your replacement environment. The number of currently healthy instances in the Amazon EC2 Auto Scaling group you choose is created in your replacement environment.
   + If you chose **Manually provision instances**: Enable **Amazon EC2 Auto Scaling groups**, **Amazon EC2 instances**, or both to specify instances to add to this deployment group. Enter Amazon EC2 tag values or Amazon EC2 Auto Scaling group names to identify the instances in your original environment (that is, the instances you want to replace or that are running the current application revision). 

1. In **Load balancer**, select **Enable load balancing**, and then from the lists, select the Classic Load Balancers, Application Load Balancer target groups, and Network Load Balancer target groups that you want to register your replacement Amazon EC2 instances with. Each replacement instance will be registered with *all* the selected Classic Load Balancers and target groups. You can select up to 10 Classic Load Balancers and 10 target groups, for a total of 20 items.

   Traffic will be rerouted from the original to the replacement instances according to your chosen **Traffic rerouting** and **Deployment configuration** settings.

   For more information about load balancers for CodeDeploy deployments, see [Integrating CodeDeploy with Elastic Load Balancing](integrations-aws-elastic-load-balancing.md).

1. In **Deployment settings**, review the default options for rerouting traffic to the replacement environment, which deployment configuration to use for the deployment, and how instances in the original environment are handled after the deployment.

   If you want to change the settings, continue to the next step. Otherwise, skip to step 15.

1. To change the deployment settings for the blue/green deployment, change any of the following settings.    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/applications-create-blue-green.html)

1. (Optional) In **Advanced**, configure options you want to include in the deployment, such as Amazon SNS notification triggers, Amazon CloudWatch alarms, or automatic rollbacks.

   For information about specifying advanced options in deployment groups, see [Configure advanced options for a deployment group](deployment-groups-configure-advanced-options.md). 

1. Choose **Create deployment group**. 

The next step is to prepare a revision to deploy to the application and deployment group. For instructions, see [Working with application revisions for CodeDeploy](application-revisions.md).

# Create an application for an Amazon ECS service deployment (console)
<a name="applications-create-ecs"></a>

 You can use the CodeDeploy console to create an application for an Amazon ECS service deployment. 

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, expand **Deploy**, and choose **Getting started**.

1. On the **Create application** page, choose **Use CodeDeploy**.

1. In **Application name**, enter the name of your application.

1. From **Compute platform**, choose **Amazon ECS**.

1. Choose **Create application**.

1. On your application page, from the **Deployment groups** tab, choose **Create deployment group**. For more information about what you need to create a deployment group for an Amazon ECS deployment, see [Before you begin an Amazon ECS deployment](deployment-steps-ecs.md#deployment-steps-prerequisites-ecs). 

1. In **Deployment group name**, enter a name that describes the deployment group.
**Note**  
If you want to use the same settings used in another deployment group (including the deployment group name and the deployment configuration), choose those settings on this page. Although this new group and the existing group might have the same name, CodeDeploy treats them as separate deployment groups, because each is associated with a separate application.

1. In **Service role**, choose a service role that grants CodeDeploy access to Amazon ECS. For more information, see [Step 2: Create a service role for CodeDeploy](getting-started-create-service-role.md).

1.  From **Load balancer name**, choose the name of the load balancer that serves traffic to your Amazon ECS service. 

1.  From **Production listener port**, choose the port and protocol for the listener that serves production traffic to your Amazon ECS service. 

1.  (Optional) From **Test listener port**, choose the port and protocol of a test listener that serves traffic to the replacement task set in your Amazon ECS service during deployment. You can specify one or more Lambda funtions in the AppSpec file that run during the `AfterAllowTestTraffic` hook. The functions can run validation tests. If a validation test fails, a deployment rollback is triggered. If the validation tests succeed, the next hook in the deployment lifecycle, `BeforeAllowTraffic`, is triggered. If a test listener port is not specified, nothing happens during the `AfterAllowTestTraffic` hook. For more information, see [AppSpec 'hooks' section for an Amazon ECS deployment](reference-appspec-file-structure-hooks.md#appspec-hooks-ecs). 

1. From **Target group 1 name** and **Target group 2 name**, choose the target groups used to route traffic during your deployment. CodeDeploy binds one target group to your Amazon ECS service's original task set and the other to its replacement task set. For more information, see [Target Groups for Your Application Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html). 

1.  Choose **Reroute traffic immediately** or **Specify when to reroute traffic** to determine when to reroute traffic to your updated Amazon ECS service. 

    If you choose **Reroute traffic immediately**, then the deployment automatically reroutes traffic after the replacement task set is provisioned. 

    If you choose **Specify when to reroute traffic**, then choose the number of days, hours, and minutes to wait after the replacement task set is successfully provisioned. During this wait time, validation tests in Lambda functions specified in the AppSpec file are executed. If the wait time expires before traffic is rerouted, then the deployment status changes to `Stopped`. 

1.  For **Original revision termination**, choose the number of days, hours, and minutes to wait after a successful deployment before the original task set in your Amazon ECS service is terminated. 

1. (Optional) In **Advanced**, configure any options you want to include in the deployment, such as Amazon SNS notification triggers, Amazon CloudWatch alarms, or automatic rollbacks.

   For more information, see [Configure advanced options for a deployment group](deployment-groups-configure-advanced-options.md). 

# Create an application for an AWS Lambda function deployment (console)
<a name="applications-create-lambda"></a>

You can use the CodeDeploy console to create an application for an AWS Lambda function deployment.

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, expand **Deploy**, and choose **Getting started**.

1. On the **Create application** page, choose **Use CodeDeploy**.

1. Enter the name of your application in **Application name**.

1. From **Compute platform**, choose **AWS Lambda**.

1. Choose **Create application**.

1. On your application page, from the **Deployment groups** tab, choose **Create deployment group**.

1. In **Deployment group name**, enter a name that describes the deployment group.
**Note**  
If you want to use the same settings used in another deployment group (including the deployment group name and the deployment configuration), choose those settings on this page. Although this new deployment group and the existing deployment group might have the same name, CodeDeploy treats them as separate deployment groups, because each is associated with a separate application.

1. In **Service role**, choose a service role that grants CodeDeploy access to AWS Lambda. For more information, see [Step 2: Create a service role for CodeDeploy](getting-started-create-service-role.md).

1.  If you want to use a predefined deployment configuration, choose one from **Deployment configuration**, and then skip to step 12. To create a custom configuration, continue to the next step.

   For more information about deployment configurations, see [Deployment configurations on an AWS Lambda compute platform](deployment-configurations.md#deployment-configuration-lambda).

1. To create a custom configuration, choose **Create deployment configuration**, and then do the following:

   1. For **Deployment configuration name**, enter a name for the configuration.

   1. From **Type**, choose a configuration type. If you choose **Canary**, traffic is shifted in two increments. If you choose **Linear**, traffic is shifted in equal increments, with an equal number of minutes between each increment.

   1. For **Step**, enter a percentage of traffic, between 1 and 99, to be shifted. If your configuration type is **Canary**, this is the percentage of traffic that is shifted in the first increment. The remaining traffic is shifted after the selected interval in the second increment. If your configuration type is **Linear**, this is the percentage of traffic that is shifted at the start of each interval.

   1. In **Interval**, enter the number of minutes. If your configuration type is **Canary**, this is the number of minutes between the first and second traffic shift. If your configuration type is **Linear**, this is the number of minutes between each incremental shift.
**Note**  
The maximum length of an AWS Lambda deployment is two days, or 2,880 minutes. Therefore, the maximum value specified for **Interval** for a canary configuration is 2,800 minutes. The maximum value for a linear configuration depends on the value for **Step**. For example, if the step percentage of a linear traffic shift is 25%, then there are four traffic shifts. The maximum interval value is 2,880 divided by four, or 720 minutes.

   1. Choose **Create deployment configuration**.

1. (Optional) In **Advanced**, configure any options you want to include in the deployment, such as Amazon SNS notification triggers, Amazon CloudWatch alarms, or automatic rollbacks.

   For more information, see [Configure advanced options for a deployment group](deployment-groups-configure-advanced-options.md). 

1. Choose **Create deployment group**. 

# Create an application (CLI)
<a name="applications-create-cli"></a>

To use the AWS CLI to create an application, call the [create-application](https://docs.aws.amazon.com/cli/latest/reference/deploy/create-application.html) command, specifying a name that uniquely represents the application. (In an AWS account, a CodeDeploy application name can be used only once per region. You can reuse an application name in different regions.)

After you use the AWS CLI to create an application, the next step is to create a deployment group that specifies the instances to which to deploy revisions. For instructions, see [Create a deployment group with CodeDeploy](deployment-groups-create.md).

After you create the deployment group, the next step is to prepare a revision to deploy to the application and deployment group. For instructions, see [Working with application revisions for CodeDeploy](application-revisions.md).

# View application details with CodeDeploy
<a name="applications-view-details"></a>

You can use the CodeDeploy console, the AWS CLI, or the CodeDeploy APIs to view details about all applications associated with your AWS account.

**Topics**
+ [

## View application details (console)
](#applications-view-details-console)
+ [

## View application details (CLI)
](#applications-view-details-cli)

## View application details (console)
<a name="applications-view-details-console"></a>

To use the CodeDeploy console to view application details:

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, expand **Deploy**, and choose **Getting started**.

1. To view additional application details, choose the application name in the list.

## View application details (CLI)
<a name="applications-view-details-cli"></a>

To use the AWS CLI to view application details, call the **get-application** command, the **batch-get-application** command, or the **list-applications** command.

To view details about a single application, call the [get-application](https://docs.aws.amazon.com/cli/latest/reference/deploy/get-application.html) command, specifying the application name.

To view details about multiple applications, call the [batch-get-applications](https://docs.aws.amazon.com/cli/latest/reference/deploy/batch-get-applications.html) command, specifying multiple application names.

To view a list of application names, call the [list-applications](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-applications.html) command.

# Create a notification rule
<a name="notification-rule-create"></a>

You can use notification rules to notify users when there are changes to deployment applications, such as deployment successes and failures. Notification rules specify both the events and the Amazon SNS topic that is used to send notifications. For more information, see [What are notifications?](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/welcome.html)

You can use the console or the AWS CLI to create notification rules for AWS CodeDeploy. <a name="notification-rule-create-console"></a>

# To create a notification rule (console)
<a name="notification-rule-create-console"></a>

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy/](https://console.aws.amazon.com/codedeploy/).

1. Choose **Application**, and then choose an application where you want to add notifications.

1. On the application page, choose **Notify**, and then choose **Create notification rule**. You can also go to the **Settings** page for the application and 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 CodeDeploy or the notification manager.

   For more information, see [Understanding notification contents and security](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/security.html#security-notifications).

1.  In **Events that trigger notifications**, select the events for which you want to send notifications.     
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/notification-rule-create.html)

1. In **Targets**, choose **Create SNS topic**.
**Note**  
When you create the topic, the policy that allows CodeDeploy to publish events to the topic is applied for you. Using a topic created specifically for CodeDeploy notifications also helps ensure that you only add users to the subscription list for that topic that you want to see 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 deployment application. For more information, see [Configure existing Amazon SNS topics for notifications](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/set-up-sns.html) and [Understanding notification contents and security](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/security.html#security-notifications). 

1. To finish creating the rule, choose **Submit**.

1. You must subscribe users to the Amazon SNS topic for the rule before they can receive notifications. For more information, see [Subscribe users to Amazon SNS topics that are targets](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/subscribe-users-sns.html). You can also set up integration between notifications and Amazon Q Developer in chat applications to send notifications to Amazon Chime chatrooms or Slack channels. For more information, see [Configure integration between notifications and Amazon Q Developer in chat applications](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/notifications-chatbot.html).<a name="notification-rule-create-cli"></a>

# To create a notification rule (AWS CLI)
<a name="notification-rule-create-cli"></a>

1. At a terminal or command prompt, run the **create-notification rule** command to generate the JSON skeleton:

   ```
   aws codestar-notifications create-notification-rule --generate-cli-skeleton > rule.json
   ```

   You can name the file anything you want. In this example, the file is named *rule.json*.

1. Open the JSON file in a plain-text editor and edit it to include the resource, event types, and Amazon SNS target you want for the rule. The following example shows a notification rule named **MyNotificationRule** for an application named *MyDeploymentApplication* in an AWS acccount with the ID *123456789012*. Notifications are sent with the full detail type to an Amazon SNS topic named *codestar-notifications-MyNotificationTopic* when deployments are successful:

   ```
   {
       "Name": "MyNotificationRule",
       "EventTypeIds": [
           "codedeploy-application-deployment-succeeded"
       ],
       "Resource": "arn:aws:codebuild:us-east-2:123456789012:MyDeploymentApplication",
       "Targets": [
           {
               "TargetType": "SNS",
               "TargetAddress": "arn:aws:sns:us-east-2:123456789012:codestar-notifications-MyNotificationTopic"
           }
       ],
       "Status": "ENABLED",
       "DetailType": "FULL"
   }
   ```

   Save the file.

1. Using the file you just edited, at the terminal or command line, run the **create-notification-rule** command again to create the notification rule:

   ```
   aws codestar-notifications create-notification-rule --cli-input-json  file://rule.json
   ```

1. If successful, the command returns the ARN of the notification rule, similar to the following:

   ```
   {
       "Arn": "arn:aws:codestar-notifications:us-east-1:123456789012:notificationrule/dc82df7a-EXAMPLE"
   }
   ```

# Rename a CodeDeploy application
<a name="applications-rename"></a>

You can use the AWS CLI or the CodeDeploy APIs to change the name of an application.

To view a list of application names, use the AWS CLI to call the [list-applications](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-applications.html) command.

For information about using the AWS CLI to change an application name, see [update-application](https://docs.aws.amazon.com/cli/latest/reference/deploy/update-application.html).

For information about using the CodeDeploy APIs to change an application name, see [API\$1UpdateApplication](https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_UpdateApplication.html).

# Delete an application in CodeDeploy
<a name="applications-delete"></a>

You can use the CodeDeploy console, the AWS CLI, or a CodeDeploy API action to delete applications. For information about using the CodeDeploy API action, see [DeleteApplication](https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_DeleteApplication.html).

**Warning**  
Deleting an application removes information about the application from the CodeDeploy system, including all related deployment group information and deployment details. Deleting an application created for an EC2/On-Premises deployment does not remove any application revisions from instances nor does it delete revisions from Amazon S3 buckets. Deleting an application created for an EC2/On-Premises deployment does not terminate any Amazon EC2 instances or deregister any on-premises instances. This action cannot be undone.

**Topics**
+ [

## Delete an application (console)
](#applications-delete-console)
+ [

## Delete an application (AWS CLI)
](#applications-delete-cli)

## Delete an application (console)
<a name="applications-delete-console"></a>

To use the CodeDeploy console to delete an application:

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, expand **Deploy**, then choose **Applications**.

1. In the list of applications, choose the the application you want to delete.

   A page appears containing details about the application.

1. Choose **Delete application** on the top-right.

1. When prompted, enter **delete** to confirm you want to delete the application, and then choose **Delete**. 

## Delete an application (AWS CLI)
<a name="applications-delete-cli"></a>

To use the AWS CLI to delete an application, call the [delete-application](https://docs.aws.amazon.com/cli/latest/reference/deploy/delete-application.html) command, specifying the application name. To view a list of application names, call the [list-applications](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-applications.html) command.