View a markdown version of this page

AWS-CreateDSManagementInstance - AWS Systems Manager Automation Runbook 參考

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

AWS-CreateDSManagementInstance

Description

AWS-CreateDSManagementInstance Runbook 會建立 Amazon Elastic Compute Cloud (Amazon EC2) Windows 執行個體,供您用來管理 AWS Directory Service 目錄。管理執行個體無法用於管理 AD Connector 目錄。

執行此自動化 (主控台)

注意

根據預設,如果 目錄已存在網域聯結文件,此 Runbook 會重複使用您帳戶中的現有網域聯結文件。若要讓 Runbook 一律改用 AWS 擁有的公有文件AWS-JoinDirectoryServiceDomain-V2,請將 UseAWSManagedDomainJoinDocument 參數設定為 true。我們建議在授予 等 AWS Systems Manager 文件許可時,使用 true,並遵循最低權限原則ssm:CreateDocument。如需詳細資訊,請參閱 AWS Identity and Access Management 《 使用者指南》中的 IAM 中的安全最佳實務。

文件類型

 自動化

擁有者

Amazon

平台

Windows

參數

  • AutomationAssumeRole

    類型:字串

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

  • AmiID

    類型:字串

    預設:{{ ssm:/aws/service/ami-windows-latest/Windows_Server-2019-English-Full-Base }}

    描述:(選用) Amazon Machine Image(AMI) 用來啟動執行個體的 ID。根據預設,執行個體將使用最新的 Microsoft Windows Server 2019 Base AMI 啟動。

  • DirectoryId

    類型:字串

    描述:(必要) 目錄的 Directory Service 目錄 ID。

  • IamInstanceProfileName

    類型:字串

    描述:(選用) IAM 執行個體描述檔名稱。根據預設,如果名稱為 AmazonSSMDirectoryServiceInstanceProfileRole 的執行個體描述檔不存在,則會建立名稱為 AmazonSSMDirectoryServiceInstanceProfileRole 的執行個體描述檔。

    預設:AmazonSSMDirectoryServiceInstanceProfileRole

  • InstanceType

    類型:字串

    預設:t3.medium

    允許的值:

    • t2.nano

    • t2.micro

    • t2.small

    • t2.medium

    • t2.large

    • t2.xlarge

    • t2.2xlarge

    • t3.nano

    • t3.micro

    • t3.small

    • t3.medium

    • t3.large

    • t3.xlarge

    • t3.2xlarge

    描述:(選用) 要啟動的執行個體類型。預設為 t3.medium。

  • KeyPairName

    類型:字串

    描述:(選用) 啟動執行個體時要使用的金鑰對。Windows 不支援 ED25519 金鑰對。根據預設,執行個體在沒有金鑰對的情況下啟動 (NoKeyPair)。

    預設:NoKeyPair

  • RemoteAccessCidr

    類型:字串

    描述:(選用) 建立 RDP 連接埠 (連接埠範圍 3389) 的安全群組,開放給 CIDR 指定的 IPs (預設為 0.0.0.0/0)。如果安全群組已存在,則不會修改,規則也不會變更。

    預設:0.0.0.0/0

  • SecurityGroupName

    類型:字串

    描述:(選用) 安全群組名稱。根據預設,如果名稱為 AmazonSSMDirectoryServiceSecurityGroup 的安全群組不存在,則會建立名稱為 AmazonSSMDirectoryServiceSecurityGroup 的安全群組。

    預設:AmazonSSMDirectoryServiceSecurityGroup

  • Tags (標籤)

    類型:MapList

    描述:(選用) 您要套用至自動化所建立資源的鍵/值對。

    預設: [ {"Key":"Description","Value":"Created by AWS Systems Manager Automation"}, {"Key":"Created By","Value":"AWS Systems Manager Automation"} ]

  • UseAWSManagedDomainJoinDocument

    類型:字串

    有效值:false | true

    預設:false

    描述:(選用) 決定 Runbook 用來將新執行個體加入目錄的文件。設為 時true, Runbook 會使用 AWS 擁有的公有文件 AWS-JoinDirectoryServiceDomain-V2。設為 false(預設值) 時,如果已存在,則 Runbook 會重複使用目錄的現有網域聯結文件,否則會建立一個、執行它,然後刪除它。建議您將此參數設定為 true。

必要的 IAM 許可

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

  • ds:DescribeDirectories

  • ec2:AuthorizeSecurityGroupIngress

  • ec2:CreateSecurityGroup

  • ec2:CreateTags

  • ec2:DeleteSecurityGroup

  • ec2:DescribeInstances

  • ec2:DescribeInstanceStatus

  • ec2:DescribeKeyPairs

  • ec2:DescribeSecurityGroups

  • ec2:DescribeVpcs

  • ec2:RunInstances

  • ec2:TerminateInstances

  • iam:AddRoleToInstanceProfile

  • iam:AttachRolePolicy

  • iam:CreateInstanceProfile

  • iam:CreateRole

  • iam:DeleteInstanceProfile

  • iam:DeleteRole

  • iam:DetachRolePolicy

  • iam:GetInstanceProfile

  • iam:GetRole

  • iam:ListAttachedRolePolicies

  • iam:ListInstanceProfiles

  • iam:ListInstanceProfilesForRole

  • iam:PassRole

  • iam:RemoveRoleFromInstanceProfile

  • iam:TagInstanceProfile

  • iam:TagRole

  • ssm:CreateDocument

  • ssm:DeleteDocument

  • ssm:DescribeInstanceInformation

  • ssm:GetAutomationExecution

  • ssm:GetParameters

  • ssm:ListCommandInvocations

  • ssm:ListCommands

  • ssm:ListDocuments

  • ssm:SendCommand

  • ssm:StartAutomationExecution

文件步驟

  • aws:executeAwsApi - 收集您在 DirectoryId 參數中指定之目錄的詳細資訊。

  • aws:executeAwsApi - 取得啟動目錄之虛擬私有雲端 (VPC) 的 CIDR 區塊。

  • aws:executeAwsApi - 使用您在 SecurityGroupName 參數中指定的值建立安全群組。

  • aws:executeAwsApi - 為新建立的安全群組建立傳入規則,允許來自您在 RemoteAccessCidr 參數中指定 CIDR 的 RDP 流量。

  • aws:executeAwsApi - 使用您在 IamInstanceProfileName 參數中指定的值建立 IAM 角色和執行個體描述檔。

  • aws:executeAwsApi - 根據您在 Runbook 參數中指定的值啟動 Amazon EC2 執行個體。

  • aws:branch - 根據 UseAWSManagedDomainJoinDocument 參數的值,決定要用於網域聯結的文件。

  • aws:runCommand - 將新執行個體加入您的目錄。

  • aws:runCommand - 在新執行個體上安裝遠端伺服器管理工具。