createReusableDelegationSet method

Future<CreateReusableDelegationSetResponse> createReusableDelegationSet({
  1. required String callerReference,
  2. String? hostedZoneId,
})

Creates a delegation set (a group of four name servers) that can be reused by multiple hosted zones that were created by the same AWS account.

You can also create a reusable delegation set that uses the four name servers that are associated with an existing hosted zone. Specify the hosted zone ID in the CreateReusableDelegationSet request. For information about using a reusable delegation set to configure white label name servers, see Configuring White Label Name Servers.

The process for migrating existing hosted zones to use a reusable delegation set is comparable to the process for configuring white label name servers. You need to perform the following steps:

  1. Create a reusable delegation set.
  2. Recreate hosted zones, and reduce the TTL to 60 seconds or less.
  3. Recreate resource record sets in the new hosted zones.
  4. Change the registrar's name servers to use the name servers for the new hosted zones.
  5. Monitor traffic for the website or application.
  6. Change TTLs back to their original values.
If you want to migrate existing hosted zones to use a reusable delegation set, the existing hosted zones can't use any of the name servers that are assigned to the reusable delegation set. If one or more hosted zones do use one or more name servers that are assigned to the reusable delegation set, you can do one of the following:
  • For small numbers of hosted zones—up to a few hundred—it's relatively easy to create reusable delegation sets until you get one that has four name servers that don't overlap with any of the name servers in your hosted zones.
  • For larger numbers of hosted zones, the easiest solution is to use more than one reusable delegation set.
  • For larger numbers of hosted zones, you can also migrate hosted zones that have overlapping name servers to hosted zones that don't have overlapping name servers, then migrate the hosted zones again to use the reusable delegation set.

May throw DelegationSetAlreadyCreated. May throw LimitsExceeded. May throw HostedZoneNotFound. May throw InvalidArgument. May throw InvalidInput. May throw DelegationSetNotAvailable. May throw DelegationSetAlreadyReusable.

Parameter callerReference : A unique string that identifies the request, and that allows you to retry failed CreateReusableDelegationSet requests without the risk of executing the operation twice. You must use a unique CallerReference string every time you submit a CreateReusableDelegationSet request. CallerReference can be any unique string, for example a date/time stamp.

Parameter hostedZoneId : If you want to mark the delegation set for an existing hosted zone as reusable, the ID for that hosted zone.

Implementation

Future<CreateReusableDelegationSetResponse> createReusableDelegationSet({
  required String callerReference,
  String? hostedZoneId,
}) async {
  ArgumentError.checkNotNull(callerReference, 'callerReference');
  _s.validateStringLength(
    'callerReference',
    callerReference,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'hostedZoneId',
    hostedZoneId,
    0,
    32,
  );
  final $result = await _protocol.sendRaw(
    method: 'POST',
    requestUri: '/2013-04-01/delegationset',
    payload: CreateReusableDelegationSetRequest(
            callerReference: callerReference, hostedZoneId: hostedZoneId)
        .toXml(
      'CreateReusableDelegationSetRequest',
      attributes: [
        _s.XmlAttribute(_s.XmlName('xmlns'),
            'https://route53.amazonaws.com/doc/2013-04-01/'),
      ],
    ),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return CreateReusableDelegationSetResponse(
    delegationSet:
        DelegationSet.fromXml(_s.extractXmlChild($elem, 'DelegationSet')!),
    location: _s.extractHeaderStringValue($result.headers, 'Location')!,
  );
}