

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

# Amazon Neptune 和 Application Auto Scaling
<a name="services-that-can-integrate-neptune"></a>

您可以使用目标跟踪扩缩策略和计划的扩缩来扩展 Neptune 集群。

使用以下信息可帮助您将 Neptune 与 Application Auto Scaling 集成。

## 为 Neptune 创建的服务关联角色
<a name="integrate-service-linked-role-neptune"></a>

在 Application Auto Scaling 中将 Neptune 资源注册为可扩展目标 AWS 账户 时，将在您的中自动创建以下服务相关角色。此角色允许 Application Auto Scaling 在您的账户中执行受支持的操作。有关更多信息，请参阅 [Application Auto Scaling 的服务相关角色](application-auto-scaling-service-linked-roles.md)。
+ `AWSServiceRoleForApplicationAutoScaling_NeptuneCluster`

## 服务相关角色使用的服务委托人
<a name="integrate-service-principal-neptune"></a>

上一节中的服务相关角色只能由为角色定义的信任关系授权的服务委托人担任。Application Auto Scaling 使用的服务相关角色为以下服务委托人授予访问权限：
+ `neptune.application-autoscaling.amazonaws.com`

## 使用 Application Auto Scaling 将 Neptune 集群注册为可扩展目标
<a name="integrate-register-neptune"></a>

Application Auto Scaling 需要一个可扩展目标，然后才能为 Neptune 集群创建扩缩策略或计划的操作。可扩展目标是 Application Auto Scaling 可以横向扩展或横向缩减的资源。可扩展目标由资源 ID、可扩展维度和命名空间的组合唯一标识。

要使用 AWS CLI 或其中一个配置自动缩放 AWS SDKs，可以使用以下选项：
+ AWS CLI: 

  调用 Neptune 集群的[register-scalable-target](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/register-scalable-target.html)命令。以下示例注册名为 `mycluster` 的集群的所需容量，最小容量为一个，最大容量为八个。

  ```
  aws application-autoscaling register-scalable-target \
    --service-namespace neptune \
    --scalable-dimension neptune:cluster:ReadReplicaCount \
    --resource-id cluster:mycluster \
    --min-capacity 1 \
    --max-capacity 8
  ```

  如果成功，该命令会返回可扩展目标的 ARN。

  ```
  {
      "ScalableTargetARN": "arn:aws:application-autoscaling:region:account-id:scalable-target/1234abcd56ab78cd901ef1234567890ab123"
  }
  ```
+ AWS 软件开发工具包：

  调用 [RegisterScalableTarget](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html) 操作并提供 `ResourceId`、`ScalableDimension`、`ServiceNamespace`、`MinCapacity` 和 `MaxCapacity` 作为参数。

## 相关资源
<a name="neptune-related-resources"></a>

*有关更多信息，请参阅 Neptune [用户指南中的自动扩展 Amazon Neptune 数据库集群中的副本数量](https://docs.aws.amazon.com/neptune/latest/userguide/manage-console-autoscaling.html)。*