Updating an AWS Cloud Map service
Depending on a service's configuration, you can update its tags, Route 53 health check failure threshold, and time to live (TTL) for DNS resolvers. To update a service, perform the following procedure.
- AWS Management Console
-
Sign in to the AWS Management Console and open the AWS Cloud Map console at https://console.aws.amazon.com/cloudmap/
. -
In the navigation pane, choose Namespaces.
-
On the Namespaces page, choose the namespace in which the service is created.
-
On the Namespace:
namespace-name
page, select the service you want to edit and choose View details. -
On the Service:
service-name
page, choose Edit.Note
You can't use the Edit button workflow to edit values for services that allow only API calls for instance discovery. However, you can add or remove tags on the Service:
service-name
page. -
On the Edit service page, under Service description, you can update any previously set description for the service or add a new description. You can also add tags and update TTL for DNS resolvers.
-
Under DNS configuration, for TTL, you can specify an updated period of time, in seconds, that determines how long DNS resolvers cache information for this record before the resolvers forward another DNS query to Amazon Route 53 to get updated settings.
-
If you've set up Route 53 health checks, for Failure threshold, you can specify a new number between 1 and 10 that defines the number of consecutive Route 53 health checks a service instance must pass or fail for its health status to change.
-
Choose Update service.
- AWS CLI
-
-
Update a service with the
update-service
command (replace thered
value with your own).aws servicediscovery update-service \ --id
srv-xxxxxxxxxxx
\ --service "Description=new description
,DnsConfig={DnsRecords=[{Type=A,TTL=60
}]}"Output:
{ "OperationId": "l3pfx7f4ynndrbj3cfq5fm2qy2z37bms-5m6iaoty" }
-
- AWS SDK for Python (Boto3)
-
-
If you don't already have
Boto3
installed, you can find instructions for installing, configuring, and usingBoto3
here. -
Import
Boto3
and useservicediscovery
as your service.import boto3 client = boto3.client('servicediscovery')
-
Update a service with
update_service()
(replace thered
value with your own).response = client.update_service( Id='
srv-xxxxxxxxxxx
', Service={ 'DnsConfig': { 'DnsRecords': [ { 'TTL':300
, 'Type': 'A', }, ], }, 'Description': "new description
", } )Example response output
{ "OperationId": "l3pfx7f4ynndrbj3cfq5fm2qy2z37bms-5m6iaoty" }
-