

# Working with application revisions for CodeDeploy
<a name="application-revisions"></a>

In CodeDeploy, a revision contains a version of the source files CodeDeploy will deploy to your instances or scripts CodeDeploy will run on your instances. 

You plan the revision, add an AppSpec file to the revision, and then push the revision to Amazon S3 or GitHub. After you push the revision, you can deploy it.

**Topics**
+ [Plan a revision](application-revisions-plan.md)
+ [Add an AppSpec File](application-revisions-appspec-file.md)
+ [Choose a repository type](application-revisions-repository-type.md)
+ [Push a revision](application-revisions-push.md)
+ [View application revision details](application-revisions-view-details.md)
+ [Register an application revision](application-revisions-register.md)

# Plan a revision for CodeDeploy
<a name="application-revisions-plan"></a>

Good planning makes deploying revisions much easier.

For deployments to an AWS Lambda or an Amazon ECS compute platform, a revision is the same as the AppSpec file. The following information does not apply. For more information, see [Add an application specification file to a revision for CodeDeploy](application-revisions-appspec-file.md) 

For deployments to an EC2/On-Premises compute platform, start by creating an empty root directory (folder) on the development machine. This is where you will store the source files (such as text and binary files, executables, packages, and so on) to be deployed to the instances or scripts to be run on the instances.

For example, at the `/tmp/` root folder in Linux, macOS, or Unix or the `c:\temp` root folder in Windows:

```
/tmp/ or c:\temp (root folder)
  |--content (subfolder)
  |    |--myTextFile.txt
  |    |--mySourceFile.rb
  |    |--myExecutableFile.exe
  |    |--myInstallerFile.msi
  |    |--myPackage.rpm
  |    |--myImageFile.png
  |--scripts (subfolder)
  |    |--myShellScript.sh
  |    |--myBatchScript.bat 
  |    |--myPowerShellScript.ps1 
  |--appspec.yml
```

The root folder should also include an application specification file (AppSpec file), as shown here. For more information, see [Add an application specification file to a revision for CodeDeploy](application-revisions-appspec-file.md).

# Add an application specification file to a revision for CodeDeploy
<a name="application-revisions-appspec-file"></a>

This topic shows how to add an AppSpec file to your deployment. It also includes templates to create an AppSpec file for an AWS Lambda and EC2/On-Premises deployment.

**Topics**
+ [Add an AppSpec file for an Amazon ECS deployment](#add-appspec-file-ecs)
+ [Add an AppSpec file for an AWS Lambda deployment](#add-appspec-file-lambda)
+ [Add an AppSpec file for an EC2/On-Premises deployment](#add-appspec-file-server)

## Add an AppSpec file for an Amazon ECS deployment
<a name="add-appspec-file-ecs"></a>

For a deployment to an Amazon ECS compute platform:
+ The AppSpec file specifies the Amazon ECS task definition used for the deployment, a container name and port mapping used to route traffic, and optional Lambda functions run after deployment lifecycle events.
+ A revision is the same as an AppSpec file.
+ An AppSpec file can be written using JSON or YAML.
+ An AppSpec file can be saved as a text file or entered directly into a console when you create a deployment. For more information, see [Create an Amazon ECS Compute Platform deployment (console)](deployments-create-console-ecs.md).

**To create an AppSpec file**

1. Copy the JSON or YAML template into a text editor or into the AppSpec editor in the console.

1. Modify the template as needed.

1. Use a JSON or YAML validator to validate your AppSpec file. If you use the AppSpec editor, the file is validated when you choose **Create deployment**.

1. If you use a text editor, save the file. If you use the AWS CLI to create your deployment, reference the AppSpec file if it's on your hard drive or in an Amazon S3 bucket. If you use the console, you must push your AppSpec file to Amazon S3.

### YAML AppSpec file template for an Amazon ECS deployment with instructions
<a name="app-spec-template-yaml-ecs"></a>

The following is a YAML template of an AppSpec file for an Amazon ECS deployment with all available options. For information about lifecycle events to use in the `hooks` section, see [AppSpec 'hooks' section for an Amazon ECS deployment](reference-appspec-file-structure-hooks.md#appspec-hooks-ecs).

```
# This is an appspec.yml template file for use with an Amazon ECS deployment in CodeDeploy.
# The lines in this template that start with the hashtag are 
#   comments that can be safely left in the file or 
#   ignored.
# For help completing this file, see the "AppSpec File Reference" in the  
#   "CodeDeploy User Guide" at
#   https://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref.html
version: 0.0
# In the Resources section, you must specify the following: the Amazon ECS service, task definition name, 
# and the name and port of the load balancer to route traffic,
# target version, and (optional) the current version of your AWS Lambda function. 
Resources:
  - TargetService:
      Type: AWS::ECS::Service
      Properties:
        TaskDefinition: "" # Specify the ARN of your task definition (arn:aws:ecs:region:account-id:task-definition/task-definition-family-name:task-definition-revision-number)
        LoadBalancerInfo: 
          ContainerName: "" # Specify the name of your Amazon ECS application's container
          ContainerPort: "" # Specify the port for your container where traffic reroutes 
# Optional properties
        PlatformVersion: "" # Specify the version of your Amazon ECS Service
        NetworkConfiguration:
          AwsvpcConfiguration:
            Subnets: ["",""] # Specify one or more comma-separated subnets in your Amazon ECS service
            SecurityGroups: ["",""] # Specify one or more comma-separated security groups in your Amazon ECS service
            AssignPublicIp: "" # Specify "ENABLED" or "DISABLED"             
# (Optional) In the Hooks section, specify a validation Lambda function to run during 
# a lifecycle event. 
Hooks:
# Hooks for Amazon ECS deployments are:
    - BeforeInstall: "" # Specify a Lambda function name or ARN
    - AfterInstall: "" # Specify a Lambda function name or ARN
    - AfterAllowTestTraffic: "" # Specify a Lambda function name or ARN
    - BeforeAllowTraffic: "" # Specify a Lambda function name or ARN
    - AfterAllowTraffic: "" # Specify a Lambda function name or ARN
```

### JSON AppSpec file for an Amazon ECS deployment template
<a name="app-spec-template-json-ecs"></a>

The following is a JSON template for an AppSpec file for an Amazon ECS deployment with all available options. For template instructions, refer to comments in the YAML version in the previous section. For information about lifecycle events to use in the `hooks` section, see [AppSpec 'hooks' section for an Amazon ECS deployment](reference-appspec-file-structure-hooks.md#appspec-hooks-ecs).

```
{
	"version": 0.0,
	"Resources": [
		{
			"TargetService": {
				"Type": "AWS::ECS::Service",
				"Properties": {
    			"TaskDefinition": "",
    			"LoadBalancerInfo": {
    				"ContainerName": "",
    				"ContainerPort":
    			},
    			"PlatformVersion": "",
    			"NetworkConfiguration": {
    				"AwsvpcConfiguration": {
    					"Subnets": [
    						"",
    						""
    					],
    					"SecurityGroups": [
    						"",
    						""
    					],
    					"AssignPublicIp": ""
    				}
    			}
  			}				
			}
		}
	],
	"Hooks": [
		{
			"BeforeInstall": ""
		},
		{
			"AfterInstall": ""
		},
		{
			"AfterAllowTestTraffic": ""
		},
		{
			"BeforeAllowTraffic": ""
		},
		{
			"AfterAllowTraffic": ""
		}
	]
}
```

## Add an AppSpec file for an AWS Lambda deployment
<a name="add-appspec-file-lambda"></a>

For a deployment to an AWS Lambda compute platform:
+ The AppSpec file contains instructions about the Lambda functions to be deployed and used for deployment validation.
+ A revision is the same as an AppSpec file.
+ An AppSpec file can be written using JSON or YAML.
+ An AppSpec file can be saved as a text file or entered directly into a console AppSpec editor when creating a deployment. For more information, see [Create an AWS Lambda Compute Platform deployment (console)](deployments-create-console-lambda.md).

To create an AppSpec file:

1. Copy the JSON or YAML template into a text editor or into the AppSpec editor in the console.

1. Modify the template as needed.

1. Use a JSON or YAML validator to validate your AppSpec file. If you use the AppSpec editor, the file is validated when you choose **Create deployment**.

1. If you use a text editor, save the file. If you use the AWS CLI to create your deployment, reference the AppSpec file if it's on your hard drive or in an Amazon S3 bucket. If you use the console, you must push your AppSpec file to Amazon S3.



### YAML AppSpec file template for an AWS Lambda deployment with instructions
<a name="app-spec-template-yaml-lambda"></a>

For information about lifecycle events to use in the hooks section, see [AppSpec 'hooks' section for an AWS Lambda deployment](reference-appspec-file-structure-hooks.md#appspec-hooks-lambda).

```
# This is an appspec.yml template file for use with an AWS Lambda deployment in CodeDeploy.
# The lines in this template starting with the hashtag symbol are 
#   instructional comments and can be safely left in the file or 
#   ignored.
# For help completing this file, see the "AppSpec File Reference" in the  
#   "CodeDeploy User Guide" at
#   https://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref.html
version: 0.0
# In the Resources section specify the name, alias, 
# target version, and (optional) the current version of your AWS Lambda function. 
Resources:
  - MyFunction: # Replace "MyFunction" with the name of your Lambda function 
      Type: AWS::Lambda::Function
      Properties:
        Name: "" # Specify the name of your Lambda function
        Alias: "" # Specify the alias for your Lambda function
        CurrentVersion: "" # Specify the current version of your Lambda function
        TargetVersion: "" # Specify the version of your Lambda function to deploy
# (Optional) In the Hooks section, specify a validation Lambda function to run during 
# a lifecycle event. Replace "LifeCycleEvent" with BeforeAllowTraffic
# or AfterAllowTraffic. 
Hooks:
    - LifeCycleEvent: "" # Specify a Lambda validation function between double-quotes.
```

### JSON AppSpec file for an AWS Lambda deployment template
<a name="app-spec-template-json-lambda"></a>

In the following template, replace "MyFunction" with the name of your AWS Lambda function. In the optional Hooks section, replace the lifecycle events with BeforeAllowTraffic or AfterAllowTraffic.

For information about lifecycle events to use in the Hooks section, see [AppSpec 'hooks' section for an AWS Lambda deployment](reference-appspec-file-structure-hooks.md#appspec-hooks-lambda).

```
{
 	"version": 0.0,
 	"Resources": [{
 		"MyFunction": {
 			"Type": "AWS::Lambda::Function",
 			"Properties": {
 				"Name": "",
 				"Alias": "",
 				"CurrentVersion": "",
 				"TargetVersion": ""
 			}
 		}
 	}],
 	"Hooks": [{
 			"LifeCycleEvent": ""
 		}
 	]
 }
```

## Add an AppSpec file for an EC2/On-Premises deployment
<a name="add-appspec-file-server"></a>

Without an AppSpec file, CodeDeploy cannot map the source files in your application revision to their destinations or run scripts for your deployment to an EC2/On-Premises compute platform, .

Each revision must contain only one AppSpec file. 

To add an AppSpec file to a revision:

1. Copy the template into a text editor.

1. Modify the template as needed.

1. Use a YAML validator to check the validity of your AppSpec file. 

1. Save the file as `appspec.yml` in the root directory of the revision.

1. Run one of the following commands to verify that you have placed your AppSpec file in the root directory:
   + For Linux, macOS, or Unix:

     ```
     find /path/to/root/directory -name appspec.yml
     ```

     There will be no output if the AppSpec file is not found there.
   + For Windows:

     ```
     dir path\to\root\directory\appspec.yml
     ```

     A **File Not Found** error will be displayed if the AppSpec file is not stored there.

1. Push the revision to Amazon S3 or GitHub. 

   For instructions, see [Push a revision for CodeDeploy to Amazon S3 (EC2/On-Premises deployments only)](application-revisions-push.md).

### AppSpec file template for an EC2/On-Premises deployment with instructions
<a name="app-spec-template-server"></a>

**Note**  
 Deployments to Windows Server instances do not support the `runas` element. If you are deploying to Windows Server instances, do not include it in your AppSpec file. 

```
# This is an appspec.yml template file for use with an EC2/On-Premises deployment in CodeDeploy.
# The lines in this template starting with the hashtag symbol are 
#   instructional comments and can be safely left in the file or 
#   ignored.
# For help completing this file, see the "AppSpec File Reference" in the  
#   "CodeDeploy User Guide" at
#   https://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref.html
version: 0.0
# Specify "os: linux" if this revision targets Amazon Linux, 
#   Red Hat Enterprise Linux (RHEL), or Ubuntu Server  
#   instances.
# Specify "os: windows" if this revision targets Windows Server instances.
# (You cannot specify both "os: linux" and "os: windows".)
os: linux 
# os: windows
# During the Install deployment lifecycle event (which occurs between the 
#   BeforeInstall and AfterInstall events), copy the specified files 
#   in "source" starting from the root of the revision's file bundle 
#   to "destination" on the Amazon EC2 instance.
# Specify multiple "source" and "destination" pairs if you want to copy 
#   from multiple sources or to multiple destinations.
# If you are not copying any files to the Amazon EC2 instance, then remove the
#   "files" section altogether. A blank or incomplete "files" section
#   may cause associated deployments to fail.
files:
  - source: 
    destination:
  - source:
    destination:
# For deployments to Amazon Linux, Ubuntu Server, or RHEL instances,
#   you can specify a "permissions" 
#   section here that describes special permissions to apply to the files 
#   in the "files" section as they are being copied over to 
#   the Amazon EC2 instance.
#   For more information, see the documentation.
# If you are deploying to Windows Server instances,
#   then remove the 
#   "permissions" section altogether. A blank or incomplete "permissions"
#   section may cause associated deployments to fail.
permissions:
  - object:
    pattern:
    except:
    owner:
    group:
    mode: 
    acls:
      -
    context:
      user:
      type:
      range:
    type:
      -
# If you are not running any commands on the Amazon EC2 instance, then remove 
#   the "hooks" section altogether. A blank or incomplete "hooks" section
#   may cause associated deployments to fail.
hooks:
# For each deployment lifecycle event, specify multiple "location" entries 
#   if you want to run multiple scripts during that event.
# You can specify "timeout" as the number of seconds to wait until failing the deployment 
#   if the specified scripts do not run within the specified time limit for the 
#   specified event. For example, 900 seconds is 15 minutes. If not specified, 
#   the default is 1800 seconds (30 minutes).
#   Note that the maximum amount of time that all scripts must finish executing 
#   for each individual deployment lifecycle event is 3600 seconds (1 hour). 
#   Otherwise, the deployment will stop and CodeDeploy will consider the deployment
#   to have failed to the Amazon EC2 instance. Make sure that the total number of seconds 
#   that are specified in "timeout" for all scripts in each individual deployment 
#   lifecycle event does not exceed a combined 3600 seconds (1 hour).
# For deployments to Amazon Linux, Ubuntu Server, or RHEL instances,
#   you can specify "runas" in an event to
#   run as the specified user. For more information, see the documentation.
#   If you are deploying to Windows Server instances,
#   remove "runas" altogether.
# If you do not want to run any commands during a particular deployment
#   lifecycle event, remove that event declaration altogether. Blank or 
#   incomplete event declarations may cause associated deployments to fail.
# During the ApplicationStop deployment lifecycle event, run the commands 
#   in the script specified in "location" starting from the root of the 
#   revision's file bundle.
  ApplicationStop:
    - location: 
      timeout:
      runas:
    - location: 
      timeout:
      runas: 
# During the BeforeInstall deployment lifecycle event, run the commands 
#   in the script specified in "location".
  BeforeInstall:
    - location: 
      timeout:
      runas: 
    - location: 
      timeout:
      runas:
# During the AfterInstall deployment lifecycle event, run the commands 
#   in the script specified in "location".
  AfterInstall:
    - location:     
      timeout: 
      runas:
    - location: 
      timeout:
      runas:
# During the ApplicationStart deployment lifecycle event, run the commands 
#   in the script specified in "location".
  ApplicationStart:
    - location:     
      timeout: 
      runas:
    - location: 
      timeout:
      runas:
# During the ValidateService deployment lifecycle event, run the commands 
#   in the script specified in "location".
  ValidateService:
    - location:     
      timeout: 
      runas:
    - location: 
      timeout:
      runas:
```

# Choose a CodeDeploy repository type
<a name="application-revisions-repository-type"></a>

The storage location for files required by CodeDeploy is called a *repository*. Use of a repository depends on which compute platform your deployment uses.
+ **EC2/On-Premises**: To deploy your application code to one or more instances, your code must be bundled into an archive file and placed in a repository where CodeDeploy can access it during the deployment process. You bundle your deployable content and an AppSpec file into an archive file, and then upload it to one of the repository types supported by CodeDeploy.
+ **AWS Lambda** and **Amazon ECS**: Deployments require an AppSpec file, which can be accessed during a deployment in one of the following ways: 
  +  From an Amazon S3 bucket. 
  +  From text typed directly into the AppSpec editor in the console. For more information, see [Create an AWS Lambda Compute Platform deployment (console)](deployments-create-console-lambda.md) and [Create an Amazon ECS Compute Platform deployment (console)](deployments-create-console-ecs.md). 
  +  If you use the AWS CLI, you can reference an AppSpec file that is on your hard drive or on a network drive. For more information, see [Create an AWS Lambda Compute Platform deployment (CLI)](deployments-create-lambda-cli.md) and [Create an Amazon ECS Compute Platform deployment (CLI)](deployments-create-ecs-cli.md). 

CodeDeploy currently supports the following repository types: 


|  |  |  | 
| --- |--- |--- |
| Repository Type | Repository Details | Supported Compute Platform | 
| Amazon S3 | [Amazon Simple Storage Service](https://docs.aws.amazon.com/AmazonS3/latest/userguide/) (Amazon S3) is the AWS solution for secure, scalable object storage. Amazon S3 stores data as objects in buckets. An object consists of a file and, optionally, any metadata that describes that file. To store an object in Amazon S3, you upload the file to a bucket. When you upload a file, you can set permissions and metadata on the object. Learn more: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-repository-type.html) | Deployments that use the following compute platforms can store the revision in an Amazon S3 bucket.[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-repository-type.html) | 
| GitHub | You can store your application revisions in [GitHub](http://www.github.com) repositories. You can trigger a deployment from a GitHub repository whenever the source code in that repository is changed.Learn more:[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-repository-type.html) | Only EC2/On-Premises deployments can store the revision in a GitHub repository. | 
| Bitbucket |  You can deploy code to deployment groups of EC2 instances by using the [CodeDeploy pipe](https://bitbucket.org/product/features/pipelines/integrations?p=atlassian/aws-code-deploy) in [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines). Bitbucket Pipelines offers continuous integration and continuous deployment (CI/CD) features, including [Bitbucket Deployments](https://confluence.atlassian.com/bitbucket/bitbucket-deployments-940695276.html). The CodeDeploy pipe first pushes the artifact to an S3 bucket that you have specified, and then deploys the code artifact from the bucket. Learn more:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-repository-type.html)  | Only EC2/On-Premises deployments can store the revision in a BitBucket repository. | 

**Note**  
An AWS Lambda deployment works with an Amazon S3 repository only.

# Push a revision for CodeDeploy to Amazon S3 (EC2/On-Premises deployments only)
<a name="application-revisions-push"></a>

After you plan your revision as described in [Plan a revision for CodeDeploy](application-revisions-plan.md) and add an AppSpec file to the revision as described in [Add an application specification file to a revision for CodeDeploy](application-revisions-appspec-file.md), you are ready to bundle the component files and push the revision to Amazon S3. For deployments to Amazon EC2 instances, after you push the revision, you can use CodeDeploy to deploy the revision from Amazon S3 to the instances.

**Note**  
CodeDeploy can also be used to deploy revisions that have been pushed to GitHub. For more information, see your GitHub documentation.

We assume you have already followed the instructions in [Getting started with CodeDeploy](getting-started-codedeploy.md) to set up the AWS CLI. This is especially important for calling the **push** command described later.

Be sure you have an Amazon S3 bucket. Follow the instructions in [Create a bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingABucket.html).

If your deployment is to Amazon EC2 instances, then the target Amazon S3 bucket must be created or exist in the same region as the target instances. For example, if you want to deploy a revision to some instances in the US East (N. Virginia) Region and other instances in the US West (Oregon) Region, then you must have one bucket in the US East (N. Virginia) Region with one copy of the revision and another bucket in the US West (Oregon) Region with another copy of the same revision. In this scenario, you would then need to create two separate deployments, one in the US East (N. Virginia) Region and another in the US West (Oregon) Region, even though the revision is the same in both regions and buckets.

You must have permissions to upload to the Amazon S3 bucket. You can specify these permissions through an Amazon S3 bucket policy. For example, in the following Amazon S3 bucket policy, using the wildcard character (\$1) allows AWS account `111122223333` to upload files to any directory in the Amazon S3 bucket named `amzn-s3-demo-bucket`:

```
{
    "Statement": [
        {
            "Action": [
                "s3:PutObject"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*",
            "Principal": {
                "AWS": [
                    "111122223333"
                ]
            }
        }
    ]
}
```

To view your AWS account ID, see [Finding Your AWS account ID](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html#FindingYourAWSId).

To learn how to generate and attach an Amazon S3 bucket policy, see [Bucket policy examples](https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html).

The user who is calling the **push** command must have, at minimum, permissions to upload the revision to each target Amazon S3 bucket. For example, the following policy allows the user to upload revisions anywhere in the Amazon S3 bucket named `amzn-s3-demo-bucket`:

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject"
            ],
            "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*"
        }
    ]
}
```

------

To learn how to create and attach an IAM policy, see [Working with policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/ManagingPolicies.html#AddingPermissions_Console).

## Push a revision using the AWS CLI
<a name="push-with-cli"></a>

**Note**  
 The `push` command bundles application artifacts and an AppSpec file into a revision. The file format of this revision is a compressed ZIP file. The command cannot be used with an AWS Lambda or an Amazon ECS deployment because each expects a revision that is a JSON-formatted or YAML-formatted AppSpec file. 

Call the **push** command to bundle and push the revision for a deployment. Its parameters are:
+  **--application-name**: (string) Required. The name of the CodeDeploy application to be associated with the application revision. 
+  **--s3-location**: (string) Required. Information about the location of the application revision to be uploaded to Amazon S3. You must specify an Amazon S3 bucket and a key. The key is the name of the revision. CodeDeploy zips the content before it is uploaded. Use the format `s3://amzn-s3-demo-bucket/your-key.zip`. 
+  **--ignore-hidden-files** or **--no-ignore-hidden-files**: (boolean) Optional. Use the `--no-ignore-hidden-files` flag (the default) to bundle and upload hidden files to Amazon S3. Use the `--ignore-hidden-files` flag to not bundle and upload hidden files to Amazon S3. 
+  **--source** (string) Optional. The location of the content to be deployed and the AppSpec file on the development machine to be zipped and uploaded to Amazon S3. The location is specified as a path relative to the current directory. If the relative path is not specified or if a single period is used for the path ("."), the current directory is used. 
+  **--description** (string) Optional. A comment that summarizes the application revision. If not specified, the default string "Uploaded by AWS CLI 'time' UTC" is used, where 'time' is the current system time in Coordinated Universal Time (UTC). 

You can use the AWS CLI to push a revision for an Amazon EC2 deployment. An example push command looks like this: 

In Linux, macOS, or Unix:

```
aws deploy push \
  --application-name WordPress_App \
  --description "This is a revision for the application WordPress_App" \
  --ignore-hidden-files \
  --s3-location s3://amzn-s3-demo-bucket/WordPressApp.zip \
  --source .
```

 In Windows: 

```
aws deploy push --application-name WordPress_App --description "This is a revision for the application WordPress_App" --ignore-hidden-files --s3-location s3://amzn-s3-demo-bucket/WordPressApp.zip --source .
```

 This command does the following: 
+  Associates the bundled files with an application named `WordPress_App`. 
+  Attaches a description to the revision. 
+  Ignores hidden files. 
+  Names the revision `WordPressApp.zip` and pushes it to a bucket named `amzn-s3-demo-bucket`. 
+  Bundles all files in the root directory into the revision. 

After the push is successful, you can use the AWS CLI or the CodeDeploy console to deploy the revision from Amazon S3. To deploy this revision with the AWS CLI: 

 In Linux, macOS, or Unix: 

```
aws deploy create-deployment \
  --application-name WordPress_App \ 
  --deployment-config-name your-deployment-config-name \ 
  --deployment-group-name your-deployment-group-name \ 
  --s3-location bucket=amzn-s3-demo-bucket,key=WordPressApp.zip,bundleType=zip
```

 In Windows: 

```
aws deploy create-deployment --application-name WordPress_App --deployment-config-name your-deployment-config-name --deployment-group-name your-deployment-group-name --s3-location bucket=amzn-s3-demo-bucket,key=WordPressApp.zip,bundleType=zip
```

 For more information, see [Create a deployment with CodeDeploy](deployments-create.md). 

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

You can use the CodeDeploy console, the AWS CLI, or the CodeDeploy APIs to view details about all application revisions that are registered to your AWS account for a specified application.

For information about registering a revision, see [Register an application revision in Amazon S3 with CodeDeploy](application-revisions-register.md).

**Topics**
+ [View application revision details (console)](#application-revisions-view-details-console)
+ [View application revision details (CLI)](#application-revisions-view-details-cli)

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

To view application revision 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 **Applications**.
**Note**  
If no entries are displayed, make sure the correct region is selected. On the navigation bar, in the region selector, choose one of the regions listed in [Region and Endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html#codedeploy_region) in the *AWS General Reference*. CodeDeploy is supported in these regions only.

1. Choose the name of the application that has the revision you want to view.

1. On the **Application details** page, choose the **Revisions** tab, and review the list of revisions that are registered for the application. Choose a revision, then choose **View details**.

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

To use the AWS CLI to view an application revision, call either the ****get-application-revision**** command or the ****list-application-revisions**** command.

**Note**  
 References to GitHub apply to deployments to EC2/On-Premises deployments only. Revisions for AWS Lambda deployments do not work with GitHub. 

To view details about a single application revision, call the [get-application-revision](https://docs.aws.amazon.com/cli/latest/reference/deploy/get-application-revision.html) command, specifying: 
+ The application name. To get the application name, call the [list-applications](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-applications.html) command.
+ For a revision stored in GitHub, the GitHub repository name and the ID of the commit that references the application revision that was pushed to the repository.
+ For a revision stored in Amazon S3, the Amazon S3 bucket name containing the revision; the name and file type of the uploaded archive file; and, optionally, the archive file's Amazon S3 version identifier and ETag. If the version identifier, ETag, or both were specified during a call to [register-application-revision](https://docs.aws.amazon.com/cli/latest/reference/deploy/register-application-revision.html), they must be specified here.

To view details about multiple application revisions, call the [list-application-revisions](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-application-revisions.html) command, specifying:
+ The application name. To get the application name, call the [list-applications](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-applications.html) command.
+ Optionally, to view details for Amazon S3 application revisions only, the Amazon S3 bucket name containing the revisions.
+ Optionally, to view details for Amazon S3 application revisions only, a prefix string to limit the search to Amazon S3 application revisions. (If not specified, CodeDeploy will list all matching Amazon S3 application revisions.)
+ Optionally, whether to list revision details based on whether each revision is the target revision of a deployment group. (If not specified, CodeDeploy will list all matching revisions.)
+ Optionally, the column name and order by which to sort the list of revision details. (If not specified, CodeDeploy will list results in an arbitrary order.)

You can list all revisions or only those revisions stored in Amazon S3. You cannot list only those revisions stored in GitHub.

# Register an application revision in Amazon S3 with CodeDeploy
<a name="application-revisions-register"></a>

If you've already called the [push](https://docs.aws.amazon.com/cli/latest/reference/deploy/push.html) command to push an application revision to Amazon S3, you don't need to register the revision. However, if you upload a revision to Amazon S3 through other means and want the revision to appear in the CodeDeploy console or through the AWS CLI, follow these steps to register the revision first.

If you've pushed an application revision to a GitHub repository and want the revision to appear in the CodeDeploy console or through the AWS CLI, you must also follow these steps.

You can use only the AWS CLI or the CodeDeploy APIs to register application revisions in Amazon S3 or GitHub.

**Topics**
+ [Register a revision in Amazon S3 with CodeDeploy (CLI)](#application-revisions-register-s3)
+ [Register a revision in GitHub with CodeDeploy (CLI)](#application-revisions-register-github)

## Register a revision in Amazon S3 with CodeDeploy (CLI)
<a name="application-revisions-register-s3"></a>

1. Upload the revision to Amazon S3.

1. Call the [register-application-revision](https://docs.aws.amazon.com/cli/latest/reference/deploy/register-application-revision.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.
   + Information about the revision to be registered:
     + The name of the Amazon S3 bucket that contains the revision.
     + The name and file type of the uploaded revision. For AWS Lambda deployments, the revision is an AppSpec file written in JSON or YAML. For EC2/On-Premises deployments, the revision contains a version of the source files that CodeDeploy will deploy to your instances or scripts that CodeDeploy will run on your instances.
**Note**  
The tar and compressed tar archive file formats (.tar and .tar.gz) are not supported for Windows Server instances.
     + (Optional) The revision's Amazon S3 version identifier. (If the version identifier is not specified, CodeDeploy will use the most recent version.)
     + (Optional) The revision's ETag. (If the ETag is not specified, CodeDeploy will skip object validation.)
   + (Optional) Any description you want to associate with the revision.

Information about a revision in Amazon S3 can be specified on the command line, using this syntax as part of the **register-application-revision** call. (`version` and `eTag` are optional.)

For a revision file for an EC2/On-Premises deployment:

```
--s3-location bucket=string,key=string,bundleType=tar|tgz|zip,version=string,eTag=string
```

For a revision file for an AWS Lambda deployment:

```
--s3-location bucket=string,key=string,bundleType=JSON|YAML,version=string,eTag=string
```

## Register a revision in GitHub with CodeDeploy (CLI)
<a name="application-revisions-register-github"></a>

**Note**  
AWS Lambda deployments do not work with GitHub. 

1. Upload the revision to your GitHub repository.

1. Call the [register-application-revision](https://docs.aws.amazon.com/cli/latest/reference/deploy/register-application-revision.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.
   + Information about the revision to be registered:
     + The GitHub user or group name assigned to the repository that contains the revision, followed by a forward slash (`/`), followed by the repository name.
     + The ID of the commit that references the revision in the repository.
   + (Optional) Any description you want to associate with the revision.

Information about a revision in GitHub can be specified on the command line, using this syntax as part of the **register-application-revision** call:

```
--github-location repository=string,commitId=string
```