

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 AMS 资源调度器
<a name="res-sched-using-periods"></a>

如何在 AMS 加速账户中使用 AMS 资源调度器周期。

使用以下一组 AWS Systems Manager 自动化运行手册在 AMS 资源计划程序中管理所需的时间表和周期。

**注意**  
这些 SSM 自动化操作手册可在您账户的主要 AWS 区域中找到。
+ `AWSManagedServices-AddOrUpdatePeriod`
+ `AWSManagedServices-AddOrUpdateSchedule`
+ `AWSManagedServices-DeleteScheduleOrPeriod`
+ `AWSManagedServices-DescribeScheduleOrPeriods`
+ `AWSManagedServices-EnableOrDisableAMSResourceScheduler`

此外，AMS 还规定了一个 AWS Systems Manager 需要和承担的 AWS Identity and Access Management 角色才能使用运行手册。`ams_resource_scheduler_ssm_automation_role`IAM 角色的范围由最低权限内联策略限制，该策略授予 Runbook 功能所需的 SSM 权限。

**先决条件**

在开始使用 SSM 自动化运行手册和 AMS 资源计划程序之前，请执行以下步骤。

将以下策略附加到您希望允许其使用自动化运行手册管理 AMS 资源计划程序中的计划和周期的相应 IAM 实体（用户、群组或角色）。*如果您的 IAM 实体在您的账户中拥有管理员或 PowerUser 权限，则无需使用该政策*。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowPassingResourceSchedulerRole",
            "Effect": "Allow",
            "Action": "iam:PassRole",
            "Resource": "arn:aws:iam::{{111122223333}}:role/ams_resource_scheduler_ssm_automation_role",
            "Condition": {
                "StringEquals": {
                    "iam:PassedToService": "ssm.amazonaws.com"
                }
            }
        },
        {
            "Sid": "ListAndDescribeAutomationExecutions",
            "Effect": "Allow",
            "Action": [
                "ssm:GetAutomationExecution",
                "ssm:DescribeAutomationStepExecutions"
            ],
            "Resource": "arn:aws:ssm:*:{{111122223333}}:automation-execution/*"
        },
        {
            "Sid": "ListAndDescribeResourceSchedulerSSMDocuments",
            "Effect": "Allow",
            "Action": [
                "ssm:ListDocumentVersions",
                "ssm:DescribeDocument",
                "ssm:ListDocumentMetadataHistory",
                "ssm:DescribeDocumentParameters",
                "ssm:GetDocument",
                "ssm:DescribeDocumentPermission"
            ],
            "Resource": [
                "arn:aws:ssm:*::document/AWSManagedServices-AddOrUpdatePeriod",
                "arn:aws:ssm:*::document/AWSManagedServices-AddOrUpdateSchedule",
                "arn:aws:ssm:*::document/AWSManagedServices-DeleteScheduleOrPeriod",
                "arn:aws:ssm:*::document/AWSManagedServices-DescribeScheduleOrPeriods",
                "arn:aws:ssm:*::document/AWSManagedServices-EnableOrDisableAMSResourceScheduler"
            ]
        },
        {
            "Sid": "AllowExecutionOfResourceSchedulerSSMDocuments",
            "Effect": "Allow",
            "Action": [
                "ssm:StartAutomationExecution"
            ],
            "Resource": [
                "arn:aws:ssm:*::document/AWSManagedServices-AddOrUpdatePeriod",
                "arn:aws:ssm:*::document/AWSManagedServices-AddOrUpdateSchedule",
                "arn:aws:ssm:*::document/AWSManagedServices-DeleteScheduleOrPeriod",
                "arn:aws:ssm:*::document/AWSManagedServices-DescribeScheduleOrPeriods",
                "arn:aws:ssm:*::document/AWSManagedServices-EnableOrDisableAMSResourceScheduler",
                "arn:aws:ssm:*:{{111122223333}}:automation-execution/*"
            ]
        },
        {
            "Sid": "AllowListingAllDocuments",
            "Effect": "Allow",
            "Action": "ssm:ListDocuments",
            "Resource": "*"
        },
        {
            "Sid": "AllowListingAllSSMExecutions",
            "Effect": "Allow",
            "Action": "ssm:DescribeAutomationExecutions",
            "Resource": "*"
        },
        {
            "Sid": "AllowListingIAMRolesForStartingExecutionViaConsole",
            "Effect": "Allow",
            "Action": "iam:ListRoles",
            "Resource": "*"
        }
    ]
}
```

------

您可以从 AWS Systems Manager 控制台或使用 AWS CLI 运行自动化。如果使用 AWS CLI，则可能需要安装和配置它或 AWS 工具（如果还没有）。 PowerShell有关信息，请参阅[安装或升级 AWS 命令行工具](https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-cli.html)。

[![AWS Videos](http://img.youtube.com/vi/iEfvPYFBoMg/0.jpg)](http://www.youtube.com/watch?v=iEfvPYFBoMg)
