更新服务 - Amazon Cloud Map
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

更新服务

要更新服务,请执行以下步骤。

Amazon Web Services Management Console
  1. 登录Amazon Web Services Management Console并打开Amazon Cloud Map主机,网址为 https://console.aws.amazon.com/cloudmap/

  2. 在导航窗格中,选择 Namespaces (命名空间)

  3. 命名空间页面上,选择要编辑服务的命名空间。

  4. 在 “命名空间:命名空间名称” 页面上,选择要编辑的服务,然后单击 “编辑”。

  5. 在 “服务:服务名” 页上,单击 “编辑”

  6. 编辑服务页面上,输入适用的值。

  7. 单击 “更新服务”。

Amazon CLI
  • 使用update-service命令更新服务(用您自己的值替换红色值)。

    aws servicediscovery update-service \ --id srv-xxxxxxxxxxx \ --service "Description=new description,DnsConfig={DnsRecords=[{Type=A,TTL=60}]}"

    输出:

    { "OperationId": "l3pfx7f4ynndrbj3cfq5fm2qy2z37bms-5m6iaoty" }
Amazon SDK for Python (Boto3)
  1. 如果您尚未Boto3安装,可以在Boto3此处找到安装、配置和使用说明。

  2. 导入Boto3并用servicediscovery作您的服务。

    import boto3 client = boto3.client('servicediscovery')
  3. 将服务更新为update_service()(用您自己的值替换红色值)。

    response = client.update_service( Id='srv-xxxxxxxxxxx', Service={ 'DnsConfig': { 'DnsRecords': [ { 'TTL': 300, 'Type': 'A', }, ], }, 'Description': "new description", } )

    示例响应输出

    { "OperationId": "l3pfx7f4ynndrbj3cfq5fm2qy2z37bms-5m6iaoty" }