Skip to content

create_vpc_endpoint async

create_vpc_endpoint(
    name: VpcEndpointName,
    vpc_id: VpcId,
    subnet_ids: SubnetIds,
    *,
    config_overrides: Optional[AsyncOpenSearchServerlessClientConfig] = None,
    security_group_ids: Optional[SecurityGroupIds] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateVpcEndpointResponse

Creates an OpenSearch Serverless-managed interface VPC endpoint. For more information, see Access Amazon OpenSearch Serverless using an interface endpoint.

Parameters:

  • name (VpcEndpointName) –

    The name of the interface endpoint.

  • vpc_id (VpcId) –

    The ID of the VPC from which you'll access OpenSearch Serverless.

  • subnet_ids (SubnetIds) –

    The ID of one or more subnets from which you'll access OpenSearch Serverless.

  • security_group_ids (Optional[SecurityGroupIds], default: None ) –

    The unique identifiers of the security groups that define the ports, protocols, and sources for inbound traffic that you are authorizing into your endpoint.

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

    Unique, case-sensitive identifier to ensure idempotency of the request.

Raises:

  • ConflictException –

    When creating a resource, thrown when a resource with the same name already exists or is being created. When deleting a resource, thrown when the resource is not in the ACTIVE, FAILED, or UPDATE_FAILED state.

  • InternalServerException –

    Thrown when an error internal to the service occurs while processing a request.

  • ServiceQuotaExceededException –

    Thrown when you attempt to create more resources than the service allows based on service quotas.

  • ValidationException –

    Thrown when the HTTP request contains invalid input or is missing required input.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_opensearchserverless/_services/async_open_search_serverless.py
async def create_vpc_endpoint(
    self,
    name: "capo_opensearchserverless.types.vpc_endpoint_name.VpcEndpointName",
    vpc_id: "capo_opensearchserverless.types.vpc_id.VpcId",
    subnet_ids: "capo_opensearchserverless.types.subnet_ids.SubnetIds",
    *,
    config_overrides: Optional[AsyncOpenSearchServerlessClientConfig] = None,
    security_group_ids: Optional[
        "capo_opensearchserverless.types.security_group_ids.SecurityGroupIds"
    ] = None,
    client_token: Optional[
        "capo_opensearchserverless.types.client_token.ClientToken"
    ] = None,
) -> "capo_opensearchserverless.types.create_vpc_endpoint_response.CreateVpcEndpointResponse":
    """<p>Creates an OpenSearch Serverless-managed interface VPC endpoint. For more information, see <a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-vpc.html">Access Amazon OpenSearch Serverless using an interface endpoint</a>.</p>

    Args:
        name: <p>The name of the interface endpoint.</p>
        vpc_id: <p>The ID of the VPC from which you'll access OpenSearch Serverless.</p>
        subnet_ids: <p>The ID of one or more subnets from which you'll access OpenSearch Serverless.</p>
        security_group_ids: <p>The unique identifiers of the security groups that define the ports, protocols, and sources for inbound traffic that you are authorizing into your endpoint.</p>
        client_token: <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>

    Raises:
        capo_opensearchserverless.errors.conflict_exception.ConflictException: <p>When creating a resource, thrown when a resource with the same name already exists or is being created. When deleting a resource, thrown when the resource is not in the ACTIVE, FAILED, or UPDATE_FAILED state.</p>
        capo_opensearchserverless.errors.internal_server_exception.InternalServerException: <p>Thrown when an error internal to the service occurs while processing a request.</p>
        capo_opensearchserverless.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Thrown when you attempt to create more resources than the service allows based on service quotas.</p>
        capo_opensearchserverless.errors.validation_exception.ValidationException: <p>Thrown when the HTTP request contains invalid input or is missing required input.</p>
        capo_opensearchserverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_opensearchserverless.types.create_vpc_endpoint_request.CreateVpcEndpointRequest]",
    ) -> AsyncOperationResponse[
        "capo_opensearchserverless.types.create_vpc_endpoint_response.CreateVpcEndpointResponse"
    ]:
        import capo_opensearchserverless._operations.open_search_serverless.create_vpc_endpoint

        (
            output,
            http_response,
        ) = await capo_opensearchserverless._operations.open_search_serverless.create_vpc_endpoint.async_create_vpc_endpoint(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateVpcEndpoint")
    )
    input_: capo_opensearchserverless.types.create_vpc_endpoint_request.CreateVpcEndpointRequest = {
        "name": name,
        "vpc_id": vpc_id,
        "subnet_ids": subnet_ids,
    }
    if security_group_ids is not None:
        input_["security_group_ids"] = security_group_ids
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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