

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

# 對啟動範本的標籤傳輸
<a name="applications-tagging-resources.launch-templates"></a>

Elastic Beanstalk 提供了一個選項，可啟用對啟動範本的標籤傳輸。此選項延續了對啟動範本的標籤型存取控制 (TBAC) 的支援。

**注意**  
啟動組態已逐步淘汰，並由啟動範本取代。如需詳細資訊，請參閱《Amazon EC2 Auto Scaling 使用者指南》中的[啟動組態](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-configurations.html)。

為了防止執行 EC2 執行個體的停機時間， CloudFormation 不會將標籤傳播到現有的啟動範本。如果有使用案例需要環境資源具備標籤，您可以啟用 Elastic Beanstalk，建立包含這些資源標籤的啟動範本。若要這麼做，請將 [aws:autoscaling:launchconfiguration](command-options-general.md#command-options-general-autoscalinglaunchconfiguration) 命名空間中的 `LaunchTemplateTagPropagationEnabled` 選項設定為 `true`。預設值為 `false`。

下列[組態檔案](ebextensions.md)範例可啟用對啟動範本的標籤傳輸。

```
option_settings:
  aws:autoscaling:launchconfiguration:
    LaunchTemplateTagPropagationEnabled: true
```

Elastic Beanstalk 只能將下列資源標籤傳播到啟動範本：
+ EBS 磁碟區
+ EC2 執行個體 
+ EC2 網路界面
+ CloudFormation 定義資源的啟動範本

存在此限制的原因是 CloudFormation 僅允許在建立範本時為資源設定標籤。如需詳細資訊，請參閱《AWS CloudFormation 使用者指南》**中的 [TagSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-tagspecification.html)。

**重要**  
將現有環境的此選項值從 `false` 變更為 `true` 可能導致現有標籤發生重大變更。
啟用此功能後，標籤的傳播會需要 EC2 替換，這可能會導致停機。您可以啟用*滾動式更新*，批次套用組態變更，從而避免在更新程序期間停機。如需詳細資訊，請參閱[組態變更](environments-updating.md)。

如需有關啟動範本的詳細資訊，請參閱以下內容：
+ *Amazon EC2 Auto Scaling User Guide* 中的 [Launch templates](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-templates.html)。
+ 《AWS CloudFormation 使用者指南》**中的[使用範本](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-guide.html)
+ 《AWS CloudFormation 使用者指南》**中的 [Elastic Beanstalk 範本程式碼片段](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-elasticbeanstalk.html)