

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

# `AWS-MigrateToNewEKSSelfManagedNodeGroup`
<a name="aws-migratetoneweksselfmanagedlinuxnodegroup"></a>

 **Description** 

 `AWS-MigrateToNewEKSSelfManagedNodeGroup` Runbook 可協助您建立新的 Amazon Elastic Kubernetes Service (Amazon EKS) Linux 節點群組，以將現有應用程式遷移至其中。如需詳細資訊，請參閱《**Amazon EKS 使用者指南**》中的[遷移至新的節點群組](https://docs.aws.amazon.com/eks/latest/userguide/migrate-stack.html)。

 [執行此自動化 （主控台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-MigrateToNewEKSSelfManagedLinuxNodeGroup) 

**文件類型**

 自動化

**擁有者**

Amazon

**平台**

Linux

**參數**
+ AutomationAssumeRole

  類型：字串

  描述：（選用） 允許 Systems Manager Automation 代表您執行動作的 (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN)。如果未指定角色，Systems Manager Automation 會使用啟動此 Runbook 之使用者的許可。
+ OldStackName

  類型：字串

  描述：（必要） 現有 CloudFormation 堆疊的名稱或堆疊 ID。
+ NewStackName

  類型：字串

  描述：（選用） 為新節點群組建立的新 CloudFormation 堆疊名稱。如果您未指定此參數的值，則會使用 格式建立堆疊名稱：`NewNodeGroup-ClusterName-AutomationExecutionID`。
+ ClusterControlPlaneSecurityGroup

  類型：字串

  描述：（選用） 您希望節點用來與 Amazon EKS 控制平面通訊的安全群組 ID。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的安全群組。
+ NodeInstanceType

  類型：字串

  描述：（選用） 您要用於新節點群組的執行個體類型。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的執行個體類型。
+ NodeGroupName

  類型：字串

  描述：（選用） 新節點群組的名稱。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的節點群組名稱。
+ NodeAutoScalingGroupDesiredCapacity

  類型：字串

  描述：（選用） 建立新堆疊時要擴展到的所需節點數量。此數字必須大於或等於 `NodeAutoScalingGroupMinSize`值，且小於或等於 `NodeAutoScalingGroupMaxSize`。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的節點群組所需容量。
+ NodeAutoScalingGroupMaxSize

  類型：字串

  描述：（選用） 節點群組可向外擴展的節點數量上限。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的節點群組大小上限。
+ NodeAutoScalingGroupMinSize

  類型：字串

  描述：（選用） 節點群組可以擴展到的節點數量下限。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的節點群組大小下限。
+ NodeImageId

  類型：字串

  描述：（選用） 您希望節點群組使用的 Amazon Machine Image(AMI) ID。
+ NodeImageIdSSMParam

  類型：字串

  描述：（選用） 您希望節點群組使用的 AMI的公有 Systems Manager 參數。
+ NodeVolumeSize

  類型：字串

  描述：（選用） GiB 中節點的根磁碟區大小。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的節點磁碟區大小。
+ NodeVolumeType

  類型：字串

  描述：（選用） 您要用於節點根磁碟區的 Amazon EBS 磁碟區類型。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的磁碟區類型。
+ KeyName

  類型：字串

  描述：（選用） 您要指派給節點的金鑰對。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的金鑰對。
+ 子網路

  類型：StringList

  描述：（選用） 您希望用於新節點群組的子網路 IDs 逗號分隔清單。如果您未指定此參數的值，則會使用現有 CloudFormation 堆疊中指定的子網路。
+ DisableIMDSv1

  類型：布林值

  描述：（選用） 指定 `true`以停用執行個體中繼資料服務第 1 版 (IMDSv1)。根據預設，節點支援 IMDSv1 和 IMDSv2。
+ BootstrapArguments

  類型：字串

  描述：（選用） 您要傳遞至節點引導指令碼的其他引數。

**必要的 IAM 許可**

`AutomationAssumeRole` 參數需要下列動作才能成功使用 Runbook。
+ `ssm:StartAutomationExecution`
+ `ssm:GetAutomationExecution`
+ `ssm:GetParameters`
+ `autoscaling:CreateAutoScalingGroup`
+ `autoscaling:CreateOrUpdateTags`
+ `autoscaling:DeleteTags`
+ `autoscaling:DescribeAutoScalingGroups`
+ `autoscaling:DescribeScalingActivities`
+ `autoscaling:DescribeScheduledActions`
+ `autoscaling:SetDesiredCapacity`
+ `autoscaling:TerminateInstanceInAutoScalingGroup`
+ `autoscaling:UpdateAutoScalingGroup`
+ `cloudformation:CreateStack`
+ `cloudformation:DescribeStackResource`
+ `cloudformation:DescribeStacks`
+ `cloudformation:UpdateStack`
+ `ec2:AuthorizeSecurityGroupEgress`
+ `ec2:AuthorizeSecurityGroupIngress`
+ `ec2:CreateLaunchTemplateVersion`
+ `ec2:CreateLaunchTemplate`
+ `ec2:CreateSecurityGroup`
+ `ec2:CreateTags`
+ `ec2:DeleteLaunchTemplate`
+ `ec2:DeleteSecurityGroup`
+ `ec2:DescribeAvailabilityZones`
+ `ec2:DescribeImages`
+ `ec2:DescribeInstanceAttribute`
+ `ec2:DescribeInstanceStatus`
+ `ec2:DescribeInstances`
+ `ec2:DescribeKeyPairs`
+ `ec2:DescribeLaunchTemplateVersions`
+ `ec2:DescribeLaunchTemplates`
+ `ec2:DescribeSecurityGroups`
+ `ec2:DescribeSubnets`
+ `ec2:DescribeVpcs`
+ `ec2:RevokeSecurityGroupEgress`
+ `ec2:RevokeSecurityGroupIngress`
+ `ec2:RunInstances`
+ `ec2:TerminateInstances`
+ `iam:AddRoleToInstanceProfile`
+ `iam:AttachRolePolicy`
+ `iam:CreateInstanceProfile`
+ `iam:CreateRole`
+ `iam:GetInstanceProfile`
+ `iam:GetRole`
+ `iam:PassRole`

 **文件步驟** 
+ DetermineParameterValuesForNewNodeGroup (aws：executeScript) - 收集用於新節點群組的參數值。
+ CreateStack (aws：createStack) - 為新節點群組建立 CloudFormation 堆疊。
+ GetNewStackNodeInstanceRole (aws：executeAwsApi) - 取得節點執行個體角色。
+ GetNewStackSecurityGroup (aws：executeAwsApi) - 步驟取得節點安全群組。
+ AddIngressRulesToNewNodeSecurityGroup (aws：executeAwsApi) - 將輸入規則新增至新建立的安全群組，以便接受從指派給您先前節點群組的流量。
+ AddIngressRulesToOldNodeSecurityGroup (aws：executeAwsApi) - 將輸入規則新增至先前的安全群組，使其可以接受來自指派給新建立節點群組的流量。
+ VerifyStackComplete (aws：assertAwsResourceProperty) - 驗證新堆疊狀態為 `CREATE_COMPLETE`。

 **輸出** 

DetermineParameterValuesForNewNodeGroup.NewStackParameters - 用來建立新堆疊的參數。

GetNewStackNodeInstanceRole.NewNodeInstanceRole - 新節點群組的節點執行個體角色。

GetNewStackSecurityGroup.NewNodeSecurityGroup - 新節點群組的安全群組 ID。

DetermineParameterValuesForNewNodeGroup.NewStackName - 新節點群組的 CloudFormation 堆疊名稱。

CreateStack.StackId - 新節點群組的 CloudFormation 堆疊 ID。