

# Create an EC2/On-Premises Compute Platform deployment (console)
<a name="deployments-create-console"></a>

This topic shows you how to deploy an application to an Amazon EC2 or on-premises server using the 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. Do one of the following:
   +  If you want to deploy an application, in the navigation pane, expand **Deploy**, and then choose **Applications**. Choose the name of the application you want to deploy. Make sure the **Compute platform** column for your application is **EC2/On-Premises**.
   +  If you want to redeploy a deployment, in the navigation pane, expand **Deploy**, and then choose **Deployments**. Locate the deployment you want to redeploy, and then choose the name of its application in the **Application** column. Make sure the **Compute platform** column for your deployment is **EC2/On-Premises**.

1. On the **Deployments** tab, choose **Create deployment**.
**Note**  
Your application must have a deployment group before it can be deployed. If your application does not have a deployment group, on the **Deployment groups** tab, choose **Create deployment group**. For more information, see [Create a deployment group with CodeDeploy](deployment-groups-create.md). 

1. In **Deployment group**, choose a deployment group to use for this deployment.

1. Next to **Repository type**, choose the repository type your revision is stored in:
   + **My application is stored in Amazon S3** — For information, see [Specify information about a revision stored in an Amazon S3 bucket](deployments-create-console-s3.md), and then return to step 6. 
   + **My application is stored in GitHub** — For information, see [Specify information about a revision stored in a GitHub repository](deployments-create-console-github.md), and then return to step 6.

1. (Optional) In **Deployment description**, enter a description for this deployment.

1. (Optional) Expand **Override deployment configuration** to choose a deployment configuration to control how traffic is shifted to the Amazon EC2 or on-premises server that is different from the one specified in the deployment group.

   For more information, see [Working with deployment configurations in CodeDeploy](deployment-configurations.md).

1. 

   1. Select **Don't fail the deployment if the ApplicationStop lifecycle event fails** if you want a deployment to an instance to succeed if the `ApplicationStop` lifecycle event fails.

   1. Expand **Additional deployment behavior settings** to specify how CodeDeploy handles files in a deployment target location that weren't part of the previous successful deployment.

      Choose from the following:
      + **Fail the deployment** — An error is reported and the deployment status is changed to `Failed`.
      + **Overwrite the content** — If a file of the same name exists in the target location, the version from the application revision replaces it.
      + **Retain the content** — If a file of the same name exists in the target location, the file is kept and the version in the application revision is not copied to the instance.

      For more information, see [Rollback behavior with existing content](deployments-rollback-and-redeploy.md#deployments-rollback-and-redeploy-content-options). 

1. (Optional) In **Rollback configuration overrides**, you can specify different automatic rollback options for this deployment than were specified for the deployment group, if any.

   For information about rollbacks in CodeDeploy, see [Redeployments and deployment rollbacks](deployment-steps-server.md#deployment-rollback) and [Redeploy and roll back a deployment with CodeDeploy](deployments-rollback-and-redeploy.md).

   Choose from the following:
   + **Roll back when a deployment fails** — CodeDeploy redeploys the last known good revision as a new deployment.
   + **Roll back when alarm thresholds are met** — If alarms were added to the deployment group, CodeDeploy deploys the last known good revision when one or more of the specified alarms is activated.
   + **Disable rollbacks** — Do not perform rollbacks for this deployment.

1. Choose **Start deployment**. 

   To track the status of your deployment, see [View CodeDeploy deployment details](deployments-view-details.md).

**Topics**
+ [Specify information about a revision stored in an Amazon S3 bucket](deployments-create-console-s3.md)
+ [Specify information about a revision stored in a GitHub repository](deployments-create-console-github.md)

# Specify information about a revision stored in an Amazon S3 bucket
<a name="deployments-create-console-s3"></a>

If you are following the steps in [Create an EC2/On-Premises Compute Platform deployment (console)](deployments-create-console.md), follow these steps to add details about an application revision stored in an Amazon S3 bucket.

1. Copy your revision's Amazon S3 link into **Revision location**. To find the link value:

   1. In a separate browser tab:

      Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

      Browse to and choose your revision.

   1. If the **Properties** pane is not visible, choose the **Properties** button.

   1. In the **Properties** pane, copy the value of the **Link** field into the **Revision location** box in the CodeDeploy console.

   To specify an ETag (a file checksum) as part of the revision location:
   + If the **Link** field value ends in **?versionId=*versionId***, add **&etag=** and the ETag to the end of the **Link** field value.
   + If the **Link** field value does not specify a version ID, add **?etag=** and the ETag to the end of the **Link** field value.
**Note**  
Although it's not as easy as copying the value of the **Link** field, you can also type the revision location in one of the following formats:  
**s3://*bucket-name*/*folders*/*objectName***  
**s3://*bucket-name*/*folders*/*objectName*?versionId=*versionId***  
**s3://*bucket-name*/*folders*/*objectName*?etag=*etag***  
**s3://*bucket-name*/*folders*/*objectName*?versionId=*versionId*&etag=*etag***  
***bucket-name*.s3.amazonaws.com/*folders*/*objectName***

1. If a message appears in the **File type** list that says the file type could not be detected, choose the revision's file type. Otherwise, accept the detected file type.

# Specify information about a revision stored in a GitHub repository
<a name="deployments-create-console-github"></a>

If you are following the steps in [Create an EC2/On-Premises Compute Platform deployment (console)](deployments-create-console.md), follow these steps to add details about an application revision stored in a GitHub repository.

1. In **Connect to GitHub**, do one of the following:
   + To create a connection for CodeDeploy applications to a GitHub account, in a different web browser tab, sign out of GitHub. In **GitHub account**, enter a name to identify this connection, and then choose **Connect to GitHub**. The webpage prompts you to authorize CodeDeploy to interact with GitHub for your application. Continue to step 2.
   + To use a connection you have already created, in **GitHub account**, select its name, and then choose **Connect to GitHub**. Continue to step 4.
   + To create a connection to a different GitHub account, in a different web browser tab, sign out of GitHub. Choose **Connect to a different GitHub account**, and then choose **Connect to GitHub**. Continue to step 2.

1. If you are prompted to sign in to GitHub, follow the instructions on the **Sign in** page. Sign in with your GitHub user name or email and password.

1. If an **Authorize application** page appears, choose **Authorize application**. 

1. On the **Create deployment** page, in the **Repository name** box, enter the GitHub user or organization name that contains the revision, followed by a forward slash (`/`), followed by the name of the repository that contains the revision. If you are unsure of the value to type:

   1. In a different web browser tab, go to your [GitHub dashboard](https://github.com/dashboard).

   1. In **Your repositories**, hover your mouse pointer over the target repository name. A tooltip appears, displaying the GitHub user or organization name, followed by a forward slash (`/`), followed by the name of the repository. Enter this displayed value into the **Repository name** box.
**Note**  
If the target repository name is not visible in **Your repositories**, use the **Search GitHub** box to find the target repository name and GitHub user or organization name.

1. In **Commit ID**, enter the ID of the commit that refers to the revision in the repository. If you are unsure of the value to type:

   1. In a different web browser tab, go to your [GitHub dashboard](https://github.com/dashboard).

   1. In **Your repositories**, choose the repository name that contains the target commit.

   1. In the list of commits, find and copy the commit ID that refers to the revision in the repository. This ID is typically 40 characters in length and consists of both letters and numbers. (Do not use the shorter version of the commit ID, which is typically the first 10 characters of the longer version of the commit ID.)

   1. Paste the commit ID into the **Commit ID** box.