AWSSupport-TroubleshootAWSBatchJob - AWS Systems Manager 自動化 Runbook 參考

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

AWSSupport-TroubleshootAWSBatchJob

Description

AWSSupport-TroubleshootAWSBatchJob Runbook 可協助您疑難排解導致 AWS Batch 任務無法從 RUNNABLE STARTING 狀態進行的問題。

如何運作?

此 Runbook 會執行下列檢查:

  • 如果運算環境處於 INVALIDDISABLED 狀態。

  • 如果運算環境的Max vCPU參數足夠大,足以容納任務佇列中的任務磁碟區。

  • 如果任務需要的 vCPUs或記憶體資源比運算環境執行個體類型能提供的資源更多。

  • 如果任務應該在 GPU 型執行個體上執行,但運算環境未設定為使用 GPU 型執行個體。

  • 如果運算環境的 Auto Scaling 群組無法啟動執行個體。

  • 如果啟動的執行個體可以加入基礎 Amazon Elastic Container Service (Amazon ECS) 叢集;否則,它會執行 AWSSupport-TroubleshootECSContainerInstance 執行手冊。

  • 如果任何許可問題封鎖執行任務所需的特定動作。

重要
  • 此 Runbook 必須在與您的任務停滯在 RUNNABLE 狀態的相同 AWS 區域中啟動。

  • 此 Runbook 可以針對在 Amazon ECS AWS Fargate 或 Amazon Elastic Compute Cloud (Amazon EC2) 執行個體上排程 AWS Batch 的任務啟動。如果針對 Amazon Elastic Kubernetes Service (Amazon EKS) 上的 AWS Batch 任務啟動自動化,則啟動會停止。

  • 如果執行個體可以執行任務,但無法註冊 Amazon ECS 叢集,此 Runbook 會啟動AWSSupport-TroubleshootECSContainerInstance自動化 Runbook,嘗試判斷原因。如需詳細資訊,請參閱 AWSSupport-TroubleshootECSContainerInstance 執行手冊。

執行此自動化 (主控台)

文件類型

 自動化

擁有者

Amazon

平台

Linux、macOS、 Windows

參數

  • AutomationAssumeRole

    類型:字串

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

  • JobId

    類型:字串

    描述:(必要) 處於 RUNNABLE 狀態 AWS Batch 的任務 ID。

    允許模式: ^[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}(:[0-9]+)?(#[0-9]+)?$

必要的 IAM 許可

AutomationAssumeRole 參數需要下列動作才能成功使用 Runbook。

  • autoscaling:DescribeAutoScalingGroups

  • autoscaling:DescribeScalingActivities

  • batch:DescribeComputeEnvironments

  • batch:DescribeJobs

  • batch:DescribeJobQueues

  • batch:ListJobs

  • cloudtrail:LookupEvents

  • ec2:DescribeIamInstanceProfileAssociations

  • ec2:DescribeInstanceAttribute

  • ec2:DescribeInstances

  • ec2:DescribeInstanceTypeOfferings

  • ec2:DescribeInstanceTypes

  • ec2:DescribeNetworkAcls

  • ec2:DescribeRouteTables

  • ec2:DescribeSecurityGroups

  • ec2:DescribeSpotFleetInstances

  • ec2:DescribeSpotFleetRequests

  • ec2:DescribeSpotFleetRequestHistory

  • ec2:DescribeSubnets

  • ec2:DescribeVpcEndpoints

  • ec2:DescribeVpcs

  • ecs:DescribeClusters

  • ecs:DescribeContainerInstances

  • ecs:ListContainerInstances

  • iam:GetInstanceProfile

  • iam:GetRole

  • iam:ListRoles

  • iam:PassRole

  • iam:SimulateCustomPolicy

  • iam:SimulatePrincipalPolicy

  • ssm:DescribeAutomationExecutions

  • ssm:DescribeAutomationStepExecutions

  • ssm:GetAutomationExecution

  • ssm:StartAutomationExecution

  • sts:GetCallerIdentity

指示

  1. 在主控台中導覽至 AWSSupport-TroubleshootAWSBatchJob AWS Systems Manager 。

  2. 選取執行自動化

  3. 針對輸入參數,輸入下列內容:

    • AutomationAssumeRole (選用):

      (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN),允許 Systems Manager Automation 代表您執行動作。如果未指定角色,Systems Manager Automation 會使用啟動此 Runbook 的使用者許可。

    • JobId (必要):

      停滯在 RUNNABLE 狀態 AWS Batch 的任務 ID。

    Input parameters form with AutomationAssumeRole and JobId fields for AWS Batch job configuration.
  4. 選取執行

  5. 請注意,自動化會啟動。

  6. 文件會執行下列步驟:

    • PreflightPermissionChecks:

      針對起始使用者/角色執行飛行前 IAM 許可檢查。如果有任何缺少的許可,此步驟會提供全域輸出區段中缺少的 API 動作。

    • ProceedOnlyIfUserHasPermission:

      分支是根據您是否具有 Runbook 所有必要動作的許可。

    • AWSBatchJobEvaluation:

      針對 AWS Batch 任務執行檢查,確認其存在且處於 RUNNABLE 狀態。

    • ProceedOnlyIfBatchJobExistsAndIsinRunnableState:

      根據任務是否存在且處於 RUNNABLE 狀態的分支。

    • BatchComputeEnvironmentEvaluation:

      針對 AWS Batch 運算環境執行檢查。

    • ProceedOnlyIfComputeEnvironmentChecksAreOK:

      根據運算環境檢查是否成功進行分支。

    • UnderlyingInfraEvaluation:

      針對基礎 Auto Scaling 群組或 Spot Fleet 請求執行檢查。

    • ProceedOnlyIfInstancesNotJoiningEcsCluster:

      分支取決於是否有執行個體未加入 Amazon ECS 叢集。

    • EcsAutomationRunner:

      為未加入叢集的執行個體執行 Amazon ECS 自動化。

    • ExecutionResults:

      根據先前的步驟產生輸出。

  7. 完成後,會提供評估報告 HTML 檔案的 URI:

    成功執行 Runbook 的報告的 S3 主控台連結和 Amazon S3 URI

    Execution result summary showing errors in compute environment setup and job queue.

參考

Systems Manager Automation