

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# **eb appversion**
<a name="eb3-appversion"></a>

## Description
<a name="eb3-appversion-description"></a>

EB CLI `appversion` 命令可管理 Elastic Beanstalk [應用程式版本](concepts.md#concepts-version)。您可以在不部署的情況下建立新版本的應用程式、刪除應用程式版本或建立[應用程式版本生命週期原則](applications-lifecycle.md)。若您未使用任何選項叫用此命令，將進入[互動模式](#eb3-appversion-interactive)。

使用 `--create` 選項來建立新版本的應用程式。

使用 `--delete` 選項來刪除應用程式的版本。

使用 `lifecycle` 選項來顯示或建立應用程式版本生命週期政策。如需詳細資訊，請參閱[進行應用程式版本生命週期的設定](applications-lifecycle.md)。

## 語法
<a name="eb3-appversion-syntax"></a>

 **eb appversion** 

 **eb appversion [-c \$1 --create]** 

 **eb appversion [-d \$1 --delete] *version-label*** 

 **eb appversion lifecycle [-p \$1 --print]** 

## 選項
<a name="eb3-appversion-options"></a>


****  

|  名稱  |  描述 類型：字串  | 
| --- | --- | 
|  -a *application-name* 或 --application\$1name *application-name*  | 應用程式名稱。如果找不到具有指定名稱的應用程式，EB CLI 會為新應用程式建立應用程式版本。 僅適用與 `--create` 選項一起使用。 類型：字串  | 
|  -c 或 --create  | 建立[新版本](concepts.md#concepts-version)的應用程式。 | 
|  -d *version-label* 或 --delete *version-label*  | 刪除標記為 version-label 的應用程式版本。 | 
|  `-l` *version\$1label* 或 `--label` *version\$1label*  |  指定用於 EB CLI 建立的版本的標籤。如果您不使用此選項，EB CLI 會產生新的唯一標籤。如果您提供版本標籤，請確保它是唯一的。 僅適用與 `--create` 選項一起使用。 類型：字串  | 
|  lifecycle  | 叫用預設編輯器來建立新的應用程式版本生命週期政策。使用此政策可避免達到[應用程式版本配額](https://docs.aws.amazon.com/general/latest/gr/elasticbeanstalk.html#limits_elastic_beanstalk)。 | 
|  lifecycle -p 或 lifecycle --print  | 顯示目前的應用程式生命週期政策。 | 
|  `-m` "*version\$1description*" 或 `--message` "*version\$1description*"  |  應用程式版本的描述。它用雙引號括住。 僅適用與 `--create` 選項一起使用。 類型：字串  | 
|  `-p` 或 `--process`  |  預處理並驗證原始碼套件中的環境資訊清單和組態檔案。驗證組態檔案可能會識別問題。我們建議您在將應用程式版本部署至環境之前執行此操作。 僅適用與 `--create` 選項一起使用。  | 
|  `--source codecommit/repository-name/branch-name`  |  CodeCommit 儲存庫和分支。 僅適用與 `--create` 選項一起使用。  | 
|  `--staged`  |  使用 git 索引中暫存的文件 (而不是 HEAD 認可) 來建立應用程式版本。 僅適用與 `--create` 選項一起使用。  | 
|  `--timeout` *分鐘*  |  命令逾時前的分鐘數。 僅適用與 `--create` 選項一起使用。  | 
|  [常用選項](eb3-cmd-options.md)  |  | 

## 以互動方式使用命令
<a name="eb3-appversion-interactive"></a>

如果您使用不帶有任何引數的命令，輸出將顯示應用程式版本。它們以相反的時間順序列出，最新版本最先列出。有關畫面外觀的範例，請參閱 **Examples (範例)** 區段。請注意，狀態行顯示在底端。狀態行會顯示上下文相關資訊。

按 `d` 來刪除應用程式版本，按 `l` 來管理您的應用程式生命週期政策，或按 `q` 來退出且不進行任何變更。

**注意**  
若該版本已部署至任一環境，將無法刪除該版本。

## Output
<a name="eb3-appversion-output"></a>

帶有 `--create` 選項的命令，會顯示應用程式版本已建立的確認訊息。

帶有 `--delete` *version-label* 選項的命令，會顯示應用程式版本已刪除的確認訊息。

## 範例
<a name="eb3-appversion-example"></a>

下列範例顯示無任何部署的應用程式之互動視窗。

![\[Application window showing version history with three entries and no current deployment.\]](http://docs.aws.amazon.com/zh_tw/elasticbeanstalk/latest/dg/images/InteractiveModeNoEnvironment.png)


下列範例為已部署第四版且版本標籤為 **Sample Application (範例應用程式)** 的應用程式互動視窗。

![\[Application versions table showing 4 versions, with the latest labeled "Sample Application" deployed 2 minutes ago.\]](http://docs.aws.amazon.com/zh_tw/elasticbeanstalk/latest/dg/images/InteractiveModeWithEnvironment.png)


下列範例為 **eb appversion lifecycle -p** 命令的輸出，其中 *ACCOUNT-ID* 為使用者的帳戶 ID：

```
Application details for: lifecycle
  Region: sa-east-1
  Description: Application created from the EB CLI using "eb init"
  Date Created: 2016/12/20 02:48 UTC
  Date Updated: 2016/12/20 02:48 UTC
  Application Versions: ['Sample Application']
  Resource Lifecycle Config(s):
    VersionLifecycleConfig:
      MaxCountRule:
        DeleteSourceFromS3: False
        Enabled: False
        MaxCount: 200
      MaxAgeRule:
        DeleteSourceFromS3: False
        Enabled: False
        MaxAgeInDays: 180
    ServiceRole: arn:aws:iam::ACCOUNT-ID:role/aws-elasticbeanstalk-service-role
```