Skip to content

create_vpc_configuration async

create_vpc_configuration(
    knowledge_base_id: Id,
    vpc_id: VpcId,
    subnet_ids: SubnetIdList,
    resource_target: ResourceTarget,
    port: Port,
    protocol: VpcProtocol,
    resolution_mode: VpcResolutionMode,
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    host_header: Optional[HostHeader] = None,
    tls_server_name: Optional[TlsServerName] = None,
    name: Optional[VpcConfigurationName] = None,
    description: Optional[VpcConfigurationDescription] = None,
) -> CreateVpcConfigurationResponse

Creates a VPC configuration that lets a knowledge base connect to a resource in your private VPC. This operation is asynchronous: it returns a vpcConfigurationId with status CREATING. Poll GetVpcConfiguration until the status becomes CREATED or CREATE_FAILED.

Parameters:

  • knowledge_base_id (Id) –

    The unique identifier of the knowledge base to associate this VPC configuration with.

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

    A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.

  • vpc_id (VpcId) –

    The identifier of the VPC that the knowledge base connects through to reach the resource.

  • subnet_ids (SubnetIdList) –

    The subnets, in the VPC identified by vpcId, that the knowledge base uses to connect to the resource.

  • resource_target (ResourceTarget) –

    The private IPv4 address or DNS name of the resource you want the knowledge base to reach. The target must be privately reachable from inside your VPC, such as an internal load balancer or a private IP. The following are not supported:

    • Internet-facing endpoints

    • Loopback addresses

    • Link-local addresses

    • Wildcard addresses

    • Multicast addresses

    • IPv6 literals

  • port (Port) –

    The port on which to reach the resource.

  • protocol (VpcProtocol) –

    The protocol used to connect to the resource. Specify HTTP for plaintext or HTTPS for TLS. When you specify HTTPS, you must also provide tlsServerName.

  • resolution_mode (VpcResolutionMode) –

    Controls how a domain-name resourceTarget is resolved. This applies only when the target is a domain name; it has no effect for IP-address targets, which have no name to resolve. In all cases the resolved address must be reachable from inside your VPC. Valid values:

    • IN_VPC (default, recommended) – The target domain name is resolved privately, using the DNS resolvers of the VPC, such as private Route 53 hosted zones or on-premises DNS reachable from the VPC. Use this for targets that are private to your VPC, such as internal load balancers, private hosted-zone names, or on-premises hosts.

    • PUBLIC – The target domain name is resolved against public DNS resolvers. Select this only when the target's domain name must be resolved through public DNS and the resulting address is still reachable from the VPC, an uncommon split-horizon configuration. If you are unsure, use IN_VPC.

  • host_header (Optional[HostHeader], default: None ) –

    An optional HTTP Host header value to send when invoking the resource. Set this only if your resource (or an upstream router or ingress) routes by the Host header and that host differs from the target. This setting is independent of tlsServerName.

  • tls_server_name (Optional[TlsServerName], default: None ) –

    The expected TLS server name. The service matches this value against the Subject Alternative Names on your resource's TLS certificate during invocation. This field is required when protocol is HTTPS. Set it to a hostname on your certificate, such as app.internal.example.com. You can use a single leftmost wildcard, such as *.example.com. The value must be a hostname without a port.

  • name (Optional[VpcConfigurationName], default: None ) –

    An optional human-readable name for the VPC configuration. If you don't specify a name, the VPC configuration has no name.

  • description (Optional[VpcConfigurationDescription], default: None ) –

    An optional description of the VPC configuration. If you don't specify a description, the VPC configuration has no description.

Raises:

Source code in docs_src/capo_bedrock_agent/_services/async_bedrock_agent.py
async def create_vpc_configuration(
    self,
    knowledge_base_id: "capo_bedrock_agent.types.id.Id",
    vpc_id: "capo_bedrock_agent.types.vpc_id.VpcId",
    subnet_ids: "capo_bedrock_agent.types.subnet_id_list.SubnetIdList",
    resource_target: "capo_bedrock_agent.types.resource_target.ResourceTarget",
    port: "capo_bedrock_agent.types.port.Port",
    protocol: "capo_bedrock_agent.types.vpc_protocol.VpcProtocol",
    resolution_mode: "capo_bedrock_agent.types.vpc_resolution_mode.VpcResolutionMode",
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    client_token: Optional[
        "capo_bedrock_agent.types.client_token.ClientToken"
    ] = None,
    host_header: Optional["capo_bedrock_agent.types.host_header.HostHeader"] = None,
    tls_server_name: Optional[
        "capo_bedrock_agent.types.tls_server_name.TlsServerName"
    ] = None,
    name: Optional[
        "capo_bedrock_agent.types.vpc_configuration_name.VpcConfigurationName"
    ] = None,
    description: Optional[
        "capo_bedrock_agent.types.vpc_configuration_description.VpcConfigurationDescription"
    ] = None,
) -> "capo_bedrock_agent.types.create_vpc_configuration_response.CreateVpcConfigurationResponse":
    """<p>Creates a VPC configuration that lets a knowledge base connect to a resource in your private VPC. This operation is asynchronous: it returns a <code>vpcConfigurationId</code> with status <code>CREATING</code>. Poll <code>GetVpcConfiguration</code> until the status becomes <code>CREATED</code> or <code>CREATE_FAILED</code>.</p>

    Args:
        knowledge_base_id: <p>The unique identifier of the knowledge base to associate this VPC configuration with.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.</p>
        vpc_id: <p>The identifier of the VPC that the knowledge base connects through to reach the resource.</p>
        subnet_ids: <p>The subnets, in the VPC identified by <code>vpcId</code>, that the knowledge base uses to connect to the resource.</p>
        resource_target: <p>The private IPv4 address or DNS name of the resource you want the knowledge base to reach. The target must be privately reachable from inside your VPC, such as an internal load balancer or a private IP. The following are not supported:</p> <ul> <li> <p>Internet-facing endpoints</p> </li> <li> <p>Loopback addresses</p> </li> <li> <p>Link-local addresses</p> </li> <li> <p>Wildcard addresses</p> </li> <li> <p>Multicast addresses</p> </li> <li> <p>IPv6 literals</p> </li> </ul>
        port: <p>The port on which to reach the resource.</p>
        protocol: <p>The protocol used to connect to the resource. Specify <code>HTTP</code> for plaintext or <code>HTTPS</code> for TLS. When you specify <code>HTTPS</code>, you must also provide <code>tlsServerName</code>.</p>
        resolution_mode: <p>Controls how a domain-name <code>resourceTarget</code> is resolved. This applies only when the target is a domain name; it has no effect for IP-address targets, which have no name to resolve. In all cases the resolved address must be reachable from inside your VPC. Valid values:</p> <ul> <li> <p> <code>IN_VPC</code> (default, recommended) – The target domain name is resolved privately, using the DNS resolvers of the VPC, such as private Route 53 hosted zones or on-premises DNS reachable from the VPC. Use this for targets that are private to your VPC, such as internal load balancers, private hosted-zone names, or on-premises hosts.</p> </li> <li> <p> <code>PUBLIC</code> – The target domain name is resolved against public DNS resolvers. Select this only when the target's domain name must be resolved through public DNS and the resulting address is still reachable from the VPC, an uncommon split-horizon configuration. If you are unsure, use <code>IN_VPC</code>.</p> </li> </ul>
        host_header: <p>An optional HTTP <code>Host</code> header value to send when invoking the resource. Set this only if your resource (or an upstream router or ingress) routes by the <code>Host</code> header and that host differs from the target. This setting is independent of <code>tlsServerName</code>.</p>
        tls_server_name: <p>The expected TLS server name. The service matches this value against the Subject Alternative Names on your resource's TLS certificate during invocation. This field is required when <code>protocol</code> is <code>HTTPS</code>. Set it to a hostname on your certificate, such as <code>app.internal.example.com</code>. You can use a single leftmost wildcard, such as <code>*.example.com</code>. The value must be a hostname without a port.</p>
        name: <p>An optional human-readable name for the VPC configuration. If you don't specify a name, the VPC configuration has no name.</p>
        description: <p>An optional description of the VPC configuration. If you don't specify a description, the VPC configuration has no description.</p>

    Raises:
        capo_bedrock_agent.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock_agent.errors.conflict_exception.ConflictException: <p>There was a conflict performing an operation.</p>
        capo_bedrock_agent.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock_agent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock_agent.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
        capo_bedrock_agent.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock_agent.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock_agent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agent.types.create_vpc_configuration_request.CreateVpcConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agent.types.create_vpc_configuration_response.CreateVpcConfigurationResponse"
    ]:
        import capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.create_vpc_configuration

        (
            output,
            http_response,
        ) = await capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.create_vpc_configuration.async_create_vpc_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateVpcConfiguration")
    )
    input_: capo_bedrock_agent.types.create_vpc_configuration_request.CreateVpcConfigurationRequest = {
        "knowledge_base_id": knowledge_base_id,
        "vpc_id": vpc_id,
        "subnet_ids": subnet_ids,
        "resource_target": resource_target,
        "port": port,
        "protocol": protocol,
        "resolution_mode": resolution_mode,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if host_header is not None:
        input_["host_header"] = host_header
    if tls_server_name is not None:
        input_["tls_server_name"] = tls_server_name
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output