Skip to content

add_ip_routes

add_ip_routes(
    directory_id: DirectoryId,
    ip_routes: IpRoutes,
    *,
    config_overrides: Optional[DirectoryServiceClientConfig] = None,
    update_security_group_for_directory_controllers: Optional[
        UpdateSecurityGroupForDirectoryControllers
    ] = None,
) -> AddIpRoutesResult

If the DNS server for your self-managed domain uses a publicly addressable IP address, you must add a CIDR address block to correctly route traffic to and from your Microsoft AD on Amazon Web Services. AddIpRoutes adds this address block. You can also use AddIpRoutes to facilitate routing traffic that uses public IP ranges from your Microsoft AD on Amazon Web Services to a peer VPC.

Before you call AddIpRoutes, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the AddIpRoutes operation, see Directory Service API Permissions: Actions, Resources, and Conditions Reference.

Parameters:

  • directory_id (DirectoryId) –

    Identifier (ID) of the directory to which to add the address block.

  • ip_routes (IpRoutes) –

    IP address blocks, using CIDR format, of the traffic to route. This is often the IP address block of the DNS server used for your self-managed domain.

  • update_security_group_for_directory_controllers (Optional[UpdateSecurityGroupForDirectoryControllers], default: None ) –

    If set to true, updates the inbound and outbound rules of the security group that has the description: "Amazon Web Services created security group for directory ID directory controllers." Following are the new rules:

    Inbound:

    • Type: Custom UDP Rule, Protocol: UDP, Range: 88, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom UDP Rule, Protocol: UDP, Range: 123, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom UDP Rule, Protocol: UDP, Range: 138, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom UDP Rule, Protocol: UDP, Range: 389, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom UDP Rule, Protocol: UDP, Range: 464, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom UDP Rule, Protocol: UDP, Range: 445, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom TCP Rule, Protocol: TCP, Range: 88, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom TCP Rule, Protocol: TCP, Range: 135, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom TCP Rule, Protocol: TCP, Range: 445, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom TCP Rule, Protocol: TCP, Range: 464, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom TCP Rule, Protocol: TCP, Range: 636, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom TCP Rule, Protocol: TCP, Range: 1024-65535, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: Custom TCP Rule, Protocol: TCP, Range: 3268-33269, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: DNS (UDP), Protocol: UDP, Range: 53, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: DNS (TCP), Protocol: TCP, Range: 53, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: LDAP, Protocol: TCP, Range: 389, Source: Managed Microsoft AD VPC IPv4 CIDR

    • Type: All ICMP, Protocol: All, Range: N/A, Source: Managed Microsoft AD VPC IPv4 CIDR

    Outbound:

    • Type: All traffic, Protocol: All, Range: All, Destination: 0.0.0.0/0

    These security rules impact an internal network interface that is not exposed publicly.

Raises:

Examples:

To add a CIDR address block that routes traffic for Microsoft AD The following example adds a CIDR address block to correctly route traffic to and from your Microsoft AD on AWS.

>>> client.add_ip_routes(directory_id='d-92654abfed', ip_routes=[{'Description': 'my IpRoute', 'CidrIp': '12.12.12.12/32'}])
Source code in docs_src/capo_directory_service/_services/directory_service.py
def add_ip_routes(
    self,
    directory_id: "capo_directory_service.types.directory_id.DirectoryId",
    ip_routes: "capo_directory_service.types.ip_routes.IpRoutes",
    *,
    config_overrides: Optional[DirectoryServiceClientConfig] = None,
    update_security_group_for_directory_controllers: Optional[
        "capo_directory_service.types.update_security_group_for_directory_controllers.UpdateSecurityGroupForDirectoryControllers"
    ] = None,
) -> "capo_directory_service.types.add_ip_routes_result.AddIpRoutesResult":
    """<p>If the DNS server for your self-managed domain uses a publicly addressable IP address, you must add a CIDR address block to correctly route traffic to and from your Microsoft AD on Amazon Web Services. <i>AddIpRoutes</i> adds this address block. You can also use <i>AddIpRoutes</i> to facilitate routing traffic that uses public IP ranges from your Microsoft AD on Amazon Web Services to a peer VPC. </p> <p>Before you call <i>AddIpRoutes</i>, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the <i>AddIpRoutes</i> operation, see <a href="http://docs.aws.amazon.com/directoryservice/latest/admin-guide/UsingWithDS_IAM_ResourcePermissions.html">Directory Service API Permissions: Actions, Resources, and Conditions Reference</a>.</p>

    Args:
        directory_id: <p>Identifier (ID) of the directory to which to add the address block.</p>
        ip_routes: <p>IP address blocks, using CIDR format, of the traffic to route. This is often the IP address block of the DNS server used for your self-managed domain.</p>
        update_security_group_for_directory_controllers: <p>If set to true, updates the inbound and outbound rules of the security group that has the description: "Amazon Web Services created security group for <i>directory ID</i> directory controllers." Following are the new rules: </p> <p>Inbound:</p> <ul> <li> <p>Type: Custom UDP Rule, Protocol: UDP, Range: 88, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom UDP Rule, Protocol: UDP, Range: 123, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom UDP Rule, Protocol: UDP, Range: 138, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom UDP Rule, Protocol: UDP, Range: 389, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom UDP Rule, Protocol: UDP, Range: 464, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom UDP Rule, Protocol: UDP, Range: 445, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom TCP Rule, Protocol: TCP, Range: 88, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom TCP Rule, Protocol: TCP, Range: 135, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom TCP Rule, Protocol: TCP, Range: 445, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom TCP Rule, Protocol: TCP, Range: 464, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom TCP Rule, Protocol: TCP, Range: 636, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom TCP Rule, Protocol: TCP, Range: 1024-65535, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: Custom TCP Rule, Protocol: TCP, Range: 3268-33269, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: DNS (UDP), Protocol: UDP, Range: 53, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: DNS (TCP), Protocol: TCP, Range: 53, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: LDAP, Protocol: TCP, Range: 389, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> <li> <p>Type: All ICMP, Protocol: All, Range: N/A, Source: Managed Microsoft AD VPC IPv4 CIDR</p> </li> </ul> <p></p> <p>Outbound:</p> <ul> <li> <p>Type: All traffic, Protocol: All, Range: All, Destination: 0.0.0.0/0</p> </li> </ul> <p>These security rules impact an internal network interface that is not exposed publicly.</p>

    Raises:
        capo_directory_service.errors.client_exception.ClientException: <p>A client exception has occurred.</p>
        capo_directory_service.errors.directory_unavailable_exception.DirectoryUnavailableException: <p>The specified directory is unavailable.</p>
        capo_directory_service.errors.entity_already_exists_exception.EntityAlreadyExistsException: <p>The specified entity already exists.</p>
        capo_directory_service.errors.entity_does_not_exist_exception.EntityDoesNotExistException: <p>The specified entity could not be found.</p>
        capo_directory_service.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters are not valid.</p>
        capo_directory_service.errors.ip_route_limit_exceeded_exception.IpRouteLimitExceededException: <p>The maximum allowed number of IP addresses was exceeded. The default limit is 100 IP address blocks.</p>
        capo_directory_service.errors.service_exception.ServiceException: <p>An exception has occurred in Directory Service.</p>
        capo_directory_service.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To add a CIDR address block that routes traffic for Microsoft AD
        The following example adds a CIDR address block to correctly route traffic to and from your Microsoft AD on AWS.

        >>> client.add_ip_routes(directory_id='d-92654abfed', ip_routes=[{'Description': 'my IpRoute', 'CidrIp': '12.12.12.12/32'}])
    """

    def _handler(
        req: "OperationRequest[capo_directory_service.types.add_ip_routes_request.AddIpRoutesRequest]",
    ) -> OperationResponse[
        "capo_directory_service.types.add_ip_routes_result.AddIpRoutesResult"
    ]:
        import capo_directory_service._operations.directory_service_20150416.add_ip_routes

        output, http_response = (
            capo_directory_service._operations.directory_service_20150416.add_ip_routes.add_ip_routes(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddIpRoutes")
    )
    input_: capo_directory_service.types.add_ip_routes_request.AddIpRoutesRequest = {
        "directory_id": directory_id,
        "ip_routes": ip_routes,
    }
    if update_security_group_for_directory_controllers is not None:
        input_["update_security_group_for_directory_controllers"] = (
            update_security_group_for_directory_controllers
        )

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output