Skip to content

create_resource_configuration

create_resource_configuration(
    name: ResourceConfigurationName,
    type: ResourceConfigurationType,
    *,
    config_overrides: Optional[VPCLatticeClientConfig] = None,
    port_ranges: Optional[PortRangeList] = None,
    protocol: Optional[ProtocolType] = None,
    resource_gateway_identifier: Optional[ResourceGatewayIdentifier] = None,
    resource_configuration_group_identifier: Optional[
        ResourceConfigurationIdentifier
    ] = None,
    resource_configuration_definition: Optional[ResourceConfigurationDefinition] = None,
    allow_association_to_shareable_service_network: Optional[Boolean] = None,
    custom_domain_name: Optional[DomainName] = None,
    group_domain: Optional[DomainName] = None,
    domain_verification_identifier: Optional[DomainVerificationIdentifier] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
) -> CreateResourceConfigurationResponse

Creates a resource configuration. A resource configuration defines a specific resource. You can associate a resource configuration with a service network or a VPC endpoint.

Parameters:

  • name (ResourceConfigurationName) –

    The name of the resource configuration. The name must be unique within the account. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.

  • type (ResourceConfigurationType) –

    The type of resource configuration. A resource configuration can be one of the following types:

    • SINGLE - A single resource.

    • GROUP - A group of resources. You must create a group resource configuration before you create a child resource configuration.

    • CHILD - A single resource that is part of a group resource configuration.

    • ARN - An Amazon Web Services resource.

    • CIDR - A network segment, expressed as a range of IP addresses (a CIDR block). Use this type to share a portion of your network rather than an individual resource. A consumer accesses the resources within the CIDR range through a Tunnel VPC endpoint. You can't add a CIDR resource configuration to a service network. A CIDR resource configuration must be associated with a resource gateway whose DNS resolution is set to IN_VPC.

  • port_ranges (Optional[PortRangeList], default: None ) –

    (SINGLE, GROUP, CHILD, CIDR) The port ranges that a consumer can use to access a resource configuration (for example: 1-65535). You can separate port ranges using commas (for example: 1,2,22-30). To resolve DNS through a CIDR resource configuration, include port 53 in the port ranges.

  • protocol (Optional[ProtocolType], default: None ) –

    (SINGLE, GROUP, CIDR) The protocol accepted by the resource configuration. The default is TCP. TCP_UDP is supported only for CIDR resource configurations; specify it for a CIDR resource configuration to allow DNS resolution, which uses UDP.

  • resource_gateway_identifier (Optional[ResourceGatewayIdentifier], default: None ) –

    (SINGLE, GROUP, ARN, CIDR) The ID or ARN of the resource gateway used to connect to the resource configuration. For a child resource configuration, this value is inherited from the parent resource configuration. For a CIDR resource configuration, the associated resource gateway must have its DNS resolution set to IN_VPC so that DNS queries resolve in the context of your VPC.

  • resource_configuration_group_identifier (Optional[ResourceConfigurationIdentifier], default: None ) –

    (CHILD) The ID or ARN of the parent resource configuration of type GROUP. This is used to associate a child resource configuration with a group resource configuration.

  • resource_configuration_definition (Optional[ResourceConfigurationDefinition], default: None ) –

    Identifies the resource configuration in one of the following ways:

    • Amazon Resource Name (ARN) - Supported resource-types that are provisioned by Amazon Web Services services, such as RDS databases, can be identified by their ARN.

    • Domain name - Any domain name that is publicly resolvable.

    • IP address - For IPv4 and IPv6, only IP addresses in the VPC are supported.

    • CIDR range - For a resource configuration of type CIDR, specify a cidrResource with one or more cidrRanges (for example, 10.0.0.0/16) that cover the IP addresses of the resources you want to make accessible. You can specify up to 10 ranges, using IPv4, IPv6, or both, and each range must include a prefix length. To represent your entire network, specify 0.0.0.0/0 (IPv4) or ::/0 (IPv6) as the only range. You can't use reserved ranges such as 169.254.0.0/16, 100.64.0.0/10, 224.0.0.0/4, fe80::/10, or ff00::/8.

  • allow_association_to_shareable_service_network (Optional[Boolean], default: None ) –

    (SINGLE, GROUP, ARN) Specifies whether the resource configuration can be associated with a sharable service network. The default is false.

  • custom_domain_name (Optional[DomainName], default: None ) –

    A custom domain name for your resource configuration. Additionally, provide a DomainVerificationID to prove your ownership of a domain.

  • group_domain (Optional[DomainName], default: None ) –

    (GROUP) The group domain for a group resource configuration. Any domains that you create for the child resource are subdomains of the group domain. Child resources inherit the verification status of the domain.

  • domain_verification_identifier (Optional[DomainVerificationIdentifier], default: None ) –

    The domain verification ID of your verified custom domain name. If you don't provide an ID, you must configure the DNS settings yourself.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.

  • tags (Optional[TagMap], default: None ) –

    The tags for the resource configuration.

Raises:

Source code in docs_src/capo_vpc_lattice/_services/vpc_lattice.py
def create_resource_configuration(
    self,
    name: "capo_vpc_lattice.types.resource_configuration_name.ResourceConfigurationName",
    type: "capo_vpc_lattice.types.resource_configuration_type.ResourceConfigurationType",
    *,
    config_overrides: Optional[VPCLatticeClientConfig] = None,
    port_ranges: Optional[
        "capo_vpc_lattice.types.port_range_list.PortRangeList"
    ] = None,
    protocol: Optional["capo_vpc_lattice.types.protocol_type.ProtocolType"] = None,
    resource_gateway_identifier: Optional[
        "capo_vpc_lattice.types.resource_gateway_identifier.ResourceGatewayIdentifier"
    ] = None,
    resource_configuration_group_identifier: Optional[
        "capo_vpc_lattice.types.resource_configuration_identifier.ResourceConfigurationIdentifier"
    ] = None,
    resource_configuration_definition: Optional[
        "capo_vpc_lattice.types.resource_configuration_definition.ResourceConfigurationDefinition"
    ] = None,
    allow_association_to_shareable_service_network: Optional[
        "capo_vpc_lattice.types.boolean.Boolean"
    ] = None,
    custom_domain_name: Optional[
        "capo_vpc_lattice.types.domain_name.DomainName"
    ] = None,
    group_domain: Optional["capo_vpc_lattice.types.domain_name.DomainName"] = None,
    domain_verification_identifier: Optional[
        "capo_vpc_lattice.types.domain_verification_identifier.DomainVerificationIdentifier"
    ] = None,
    client_token: Optional[
        "capo_vpc_lattice.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_vpc_lattice.types.tag_map.TagMap"] = None,
) -> "capo_vpc_lattice.types.create_resource_configuration_response.CreateResourceConfigurationResponse":
    """<p>Creates a resource configuration. A resource configuration defines a specific resource. You can associate a resource configuration with a service network or a VPC endpoint.</p>

    Args:
        name: <p>The name of the resource configuration. The name must be unique within the account. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.</p>
        type: <p>The type of resource configuration. A resource configuration can be one of the following types:</p> <ul> <li> <p> <b>SINGLE</b> - A single resource.</p> </li> <li> <p> <b>GROUP</b> - A group of resources. You must create a group resource configuration before you create a child resource configuration.</p> </li> <li> <p> <b>CHILD</b> - A single resource that is part of a group resource configuration.</p> </li> <li> <p> <b>ARN</b> - An Amazon Web Services resource.</p> </li> <li> <p> <b>CIDR</b> - A network segment, expressed as a range of IP addresses (a CIDR block). Use this type to share a portion of your network rather than an individual resource. A consumer accesses the resources within the CIDR range through a <code>Tunnel</code> VPC endpoint. You can't add a CIDR resource configuration to a service network. A CIDR resource configuration must be associated with a resource gateway whose DNS resolution is set to <code>IN_VPC</code>.</p> </li> </ul>
        port_ranges: <p>(SINGLE, GROUP, CHILD, CIDR) The port ranges that a consumer can use to access a resource configuration (for example: 1-65535). You can separate port ranges using commas (for example: 1,2,22-30). To resolve DNS through a CIDR resource configuration, include port 53 in the port ranges.</p>
        protocol: <p>(SINGLE, GROUP, CIDR) The protocol accepted by the resource configuration. The default is <code>TCP</code>. <code>TCP_UDP</code> is supported only for CIDR resource configurations; specify it for a CIDR resource configuration to allow DNS resolution, which uses UDP.</p>
        resource_gateway_identifier: <p>(SINGLE, GROUP, ARN, CIDR) The ID or ARN of the resource gateway used to connect to the resource configuration. For a child resource configuration, this value is inherited from the parent resource configuration. For a CIDR resource configuration, the associated resource gateway must have its DNS resolution set to <code>IN_VPC</code> so that DNS queries resolve in the context of your VPC.</p>
        resource_configuration_group_identifier: <p>(CHILD) The ID or ARN of the parent resource configuration of type <code>GROUP</code>. This is used to associate a child resource configuration with a group resource configuration.</p>
        resource_configuration_definition: <p>Identifies the resource configuration in one of the following ways:</p> <ul> <li> <p> <b>Amazon Resource Name (ARN)</b> - Supported resource-types that are provisioned by Amazon Web Services services, such as RDS databases, can be identified by their ARN.</p> </li> <li> <p> <b>Domain name</b> - Any domain name that is publicly resolvable.</p> </li> <li> <p> <b>IP address</b> - For IPv4 and IPv6, only IP addresses in the VPC are supported.</p> </li> <li> <p> <b>CIDR range</b> - For a resource configuration of type CIDR, specify a <code>cidrResource</code> with one or more <code>cidrRanges</code> (for example, <code>10.0.0.0/16</code>) that cover the IP addresses of the resources you want to make accessible. You can specify up to 10 ranges, using IPv4, IPv6, or both, and each range must include a prefix length. To represent your entire network, specify <code>0.0.0.0/0</code> (IPv4) or <code>::/0</code> (IPv6) as the only range. You can't use reserved ranges such as <code>169.254.0.0/16</code>, <code>100.64.0.0/10</code>, <code>224.0.0.0/4</code>, <code>fe80::/10</code>, or <code>ff00::/8</code>.</p> </li> </ul>
        allow_association_to_shareable_service_network: <p>(SINGLE, GROUP, ARN) Specifies whether the resource configuration can be associated with a sharable service network. The default is false.</p>
        custom_domain_name: <p> A custom domain name for your resource configuration. Additionally, provide a DomainVerificationID to prove your ownership of a domain. </p>
        group_domain: <p> (GROUP) The group domain for a group resource configuration. Any domains that you create for the child resource are subdomains of the group domain. Child resources inherit the verification status of the domain. </p>
        domain_verification_identifier: <p> The domain verification ID of your verified custom domain name. If you don't provide an ID, you must configure the DNS settings yourself. </p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.</p>
        tags: <p>The tags for the resource configuration.</p>

    Raises:
        capo_vpc_lattice.errors.access_denied_exception.AccessDeniedException: <p>The user does not have sufficient access to perform this action.</p>
        capo_vpc_lattice.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Updating or deleting a resource can cause an inconsistent state.</p>
        capo_vpc_lattice.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred while processing the request.</p>
        capo_vpc_lattice.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist.</p>
        capo_vpc_lattice.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_vpc_lattice.errors.throttling_exception.ThrottlingException: <p>The limit on the number of requests per second was exceeded.</p>
        capo_vpc_lattice.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_vpc_lattice.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_vpc_lattice.types.create_resource_configuration_request.CreateResourceConfigurationRequest]",
    ) -> OperationResponse[
        "capo_vpc_lattice.types.create_resource_configuration_response.CreateResourceConfigurationResponse"
    ]:
        import capo_vpc_lattice._operations.mercury_control_plane.create_resource_configuration

        output, http_response = (
            capo_vpc_lattice._operations.mercury_control_plane.create_resource_configuration.create_resource_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateResourceConfiguration")
    )
    input_: capo_vpc_lattice.types.create_resource_configuration_request.CreateResourceConfigurationRequest = {
        "name": name,
        "type": type,
    }
    if port_ranges is not None:
        input_["port_ranges"] = port_ranges
    if protocol is not None:
        input_["protocol"] = protocol
    if resource_gateway_identifier is not None:
        input_["resource_gateway_identifier"] = resource_gateway_identifier
    if resource_configuration_group_identifier is not None:
        input_["resource_configuration_group_identifier"] = (
            resource_configuration_group_identifier
        )
    if resource_configuration_definition is not None:
        input_["resource_configuration_definition"] = (
            resource_configuration_definition
        )
    if allow_association_to_shareable_service_network is not None:
        input_["allow_association_to_shareable_service_network"] = (
            allow_association_to_shareable_service_network
        )
    if custom_domain_name is not None:
        input_["custom_domain_name"] = custom_domain_name
    if group_domain is not None:
        input_["group_domain"] = group_domain
    if domain_verification_identifier is not None:
        input_["domain_verification_identifier"] = domain_verification_identifier
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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