Skip to content

create_elasticsearch_domain async

create_elasticsearch_domain(
    domain_name: DomainName,
    *,
    config_overrides: Optional[AsyncElasticsearchServiceClientConfig] = None,
    elasticsearch_version: Optional[ElasticsearchVersionString] = None,
    elasticsearch_cluster_config: Optional[ElasticsearchClusterConfig] = None,
    ebs_options: Optional[EBSOptions] = None,
    access_policies: Optional[PolicyDocument] = None,
    snapshot_options: Optional[SnapshotOptions] = None,
    vpc_options: Optional[VPCOptions] = None,
    cognito_options: Optional[CognitoOptions] = None,
    encryption_at_rest_options: Optional[EncryptionAtRestOptions] = None,
    node_to_node_encryption_options: Optional[NodeToNodeEncryptionOptions] = None,
    advanced_options: Optional[AdvancedOptions] = None,
    log_publishing_options: Optional[LogPublishingOptions] = None,
    domain_endpoint_options: Optional[DomainEndpointOptions] = None,
    advanced_security_options: Optional[AdvancedSecurityOptionsInput] = None,
    auto_tune_options: Optional[AutoTuneOptionsInput] = None,
    tag_list: Optional[TagList] = None,
    deployment_strategy_options: Optional[DeploymentStrategyOptions] = None,
    automated_snapshot_pause_options: Optional[
        AutomatedSnapshotPauseRequestOptions
    ] = None,
    use_case: Optional[DomainUseCase] = None,
    engine_mode: Optional[DomainEngineMode] = None,
) -> CreateElasticsearchDomainResponse

Creates a new Elasticsearch domain. For more information, see Creating Elasticsearch Domains in the Amazon Elasticsearch Service Developer Guide.

Parameters:

  • domain_name (DomainName) –

    The name of the Elasticsearch domain that you are creating. Domain names are unique across the domains owned by an account within an AWS region. Domain names must start with a lowercase letter and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen).

  • elasticsearch_version (Optional[ElasticsearchVersionString], default: None ) –

    String of format X.Y to specify version for the Elasticsearch domain eg. "1.5" or "2.3". For more information, see Creating Elasticsearch Domains in the Amazon Elasticsearch Service Developer Guide.

  • elasticsearch_cluster_config (Optional[ElasticsearchClusterConfig], default: None ) –

    Configuration options for an Elasticsearch domain. Specifies the instance type and number of instances in the domain cluster.

  • ebs_options (Optional[EBSOptions], default: None ) –

    Options to enable, disable and specify the type and size of EBS storage volumes.

  • access_policies (Optional[PolicyDocument], default: None ) –

    IAM access policy as a JSON-formatted string.

  • snapshot_options (Optional[SnapshotOptions], default: None ) –

    Option to set time, in UTC format, of the daily automated snapshot. Default value is 0 hours.

  • vpc_options (Optional[VPCOptions], default: None ) –

    Options to specify the subnets and security groups for VPC endpoint. For more information, see Creating a VPC in VPC Endpoints for Amazon Elasticsearch Service Domains

  • cognito_options (Optional[CognitoOptions], default: None ) –

    Options to specify the Cognito user and identity pools for Kibana authentication. For more information, see Amazon Cognito Authentication for Kibana.

  • encryption_at_rest_options (Optional[EncryptionAtRestOptions], default: None ) –

    Specifies the Encryption At Rest Options.

  • node_to_node_encryption_options (Optional[NodeToNodeEncryptionOptions], default: None ) –

    Specifies the NodeToNodeEncryptionOptions.

  • advanced_options (Optional[AdvancedOptions], default: None ) –

    Option to allow references to indices in an HTTP request body. Must be false when configuring access to individual sub-resources. By default, the value is true. See Configuration Advanced Options for more information.

  • log_publishing_options (Optional[LogPublishingOptions], default: None ) –

    Map of LogType and LogPublishingOption, each containing options to publish a given type of Elasticsearch log.

  • domain_endpoint_options (Optional[DomainEndpointOptions], default: None ) –

    Options to specify configuration that will be applied to the domain endpoint.

  • advanced_security_options (Optional[AdvancedSecurityOptionsInput], default: None ) –

    Specifies advanced security options.

  • auto_tune_options (Optional[AutoTuneOptionsInput], default: None ) –

    Specifies Auto-Tune options.

  • tag_list (Optional[TagList], default: None ) –

    A list of Tag added during domain creation.

  • deployment_strategy_options (Optional[DeploymentStrategyOptions], default: None ) –

    Specifies the deployment strategy options.

  • automated_snapshot_pause_options (Optional[AutomatedSnapshotPauseRequestOptions], default: None ) –

    Specifies the automated snapshot pause options for the domain.

    Suspending snapshots reduces data protection. You cannot restore your domain to points in time when snapshots are suspended. Use this feature only for short-term operational needs such as migrations or maintenance windows.

    Maximum suspension duration: 3 days.

  • use_case (Optional[DomainUseCase], default: None ) –

    The primary use case for the domain. For valid values, see DomainUseCase.

  • engine_mode (Optional[DomainEngineMode], default: None ) –

    The engine mode for the domain. For valid values and requirements, see DomainEngineMode.

Raises:

  • BaseException –

    An error occurred while processing the request.

  • DisabledOperationException –

    An error occured because the client wanted to access a not supported operation. Gives http status code of 409.

  • InternalException –

    The request processing has failed because of an unknown error, exception or failure (the failure is internal to the service) . Gives http status code of 500.

  • InvalidTypeException –

    An exception for trying to create or access sub-resource that is either invalid or not supported. Gives http status code of 409.

  • LimitExceededException –

    An exception for trying to create more than allowed resources or sub-resources. Gives http status code of 409.

  • ResourceAlreadyExistsException –

    An exception for creating a resource that already exists. Gives http status code of 400.

  • ValidationException –

    An exception for missing / invalid input fields. Gives http status code of 400.

  • UnknownServiceError –

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

Source code in docs_src/capo_elasticsearch_service/_services/async_elasticsearch_service.py
async def create_elasticsearch_domain(
    self,
    domain_name: "capo_elasticsearch_service.types.domain_name.DomainName",
    *,
    config_overrides: Optional[AsyncElasticsearchServiceClientConfig] = None,
    elasticsearch_version: Optional[
        "capo_elasticsearch_service.types.elasticsearch_version_string.ElasticsearchVersionString"
    ] = None,
    elasticsearch_cluster_config: Optional[
        "capo_elasticsearch_service.types.elasticsearch_cluster_config.ElasticsearchClusterConfig"
    ] = None,
    ebs_options: Optional[
        "capo_elasticsearch_service.types.ebs_options.EBSOptions"
    ] = None,
    access_policies: Optional[
        "capo_elasticsearch_service.types.policy_document.PolicyDocument"
    ] = None,
    snapshot_options: Optional[
        "capo_elasticsearch_service.types.snapshot_options.SnapshotOptions"
    ] = None,
    vpc_options: Optional[
        "capo_elasticsearch_service.types.vpc_options.VPCOptions"
    ] = None,
    cognito_options: Optional[
        "capo_elasticsearch_service.types.cognito_options.CognitoOptions"
    ] = None,
    encryption_at_rest_options: Optional[
        "capo_elasticsearch_service.types.encryption_at_rest_options.EncryptionAtRestOptions"
    ] = None,
    node_to_node_encryption_options: Optional[
        "capo_elasticsearch_service.types.node_to_node_encryption_options.NodeToNodeEncryptionOptions"
    ] = None,
    advanced_options: Optional[
        "capo_elasticsearch_service.types.advanced_options.AdvancedOptions"
    ] = None,
    log_publishing_options: Optional[
        "capo_elasticsearch_service.types.log_publishing_options.LogPublishingOptions"
    ] = None,
    domain_endpoint_options: Optional[
        "capo_elasticsearch_service.types.domain_endpoint_options.DomainEndpointOptions"
    ] = None,
    advanced_security_options: Optional[
        "capo_elasticsearch_service.types.advanced_security_options_input.AdvancedSecurityOptionsInput"
    ] = None,
    auto_tune_options: Optional[
        "capo_elasticsearch_service.types.auto_tune_options_input.AutoTuneOptionsInput"
    ] = None,
    tag_list: Optional["capo_elasticsearch_service.types.tag_list.TagList"] = None,
    deployment_strategy_options: Optional[
        "capo_elasticsearch_service.types.deployment_strategy_options.DeploymentStrategyOptions"
    ] = None,
    automated_snapshot_pause_options: Optional[
        "capo_elasticsearch_service.types.automated_snapshot_pause_request_options.AutomatedSnapshotPauseRequestOptions"
    ] = None,
    use_case: Optional[
        "capo_elasticsearch_service.types.domain_use_case.DomainUseCase"
    ] = None,
    engine_mode: Optional[
        "capo_elasticsearch_service.types.domain_engine_mode.DomainEngineMode"
    ] = None,
) -> "capo_elasticsearch_service.types.create_elasticsearch_domain_response.CreateElasticsearchDomainResponse":
    """<p>Creates a new Elasticsearch domain. For more information, see <a href="http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomains" target="_blank">Creating Elasticsearch Domains</a> in the <i>Amazon Elasticsearch Service Developer Guide</i>.</p>

    Args:
        domain_name: <p>The name of the Elasticsearch domain that you are creating. Domain names are unique across the domains owned by an account within an AWS region. Domain names must start with a lowercase letter and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen).</p>
        elasticsearch_version: <p>String of format X.Y to specify version for the Elasticsearch domain eg. "1.5" or "2.3". For more information, see <a href="http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomains" target="_blank">Creating Elasticsearch Domains</a> in the <i>Amazon Elasticsearch Service Developer Guide</i>.</p>
        elasticsearch_cluster_config: <p>Configuration options for an Elasticsearch domain. Specifies the instance type and number of instances in the domain cluster. </p>
        ebs_options: <p>Options to enable, disable and specify the type and size of EBS storage volumes. </p>
        access_policies: <p> IAM access policy as a JSON-formatted string.</p>
        snapshot_options: <p>Option to set time, in UTC format, of the daily automated snapshot. Default value is 0 hours. </p>
        vpc_options: <p>Options to specify the subnets and security groups for VPC endpoint. For more information, see <a href="http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-vpc.html#es-creating-vpc" target="_blank">Creating a VPC</a> in <i>VPC Endpoints for Amazon Elasticsearch Service Domains</i></p>
        cognito_options: <p>Options to specify the Cognito user and identity pools for Kibana authentication. For more information, see <a href="http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-cognito-auth.html" target="_blank">Amazon Cognito Authentication for Kibana</a>.</p>
        encryption_at_rest_options: <p>Specifies the Encryption At Rest Options.</p>
        node_to_node_encryption_options: <p>Specifies the NodeToNodeEncryptionOptions.</p>
        advanced_options: <p> Option to allow references to indices in an HTTP request body. Must be <code>false</code> when configuring access to individual sub-resources. By default, the value is <code>true</code>. See <a href="http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-advanced-options" target="_blank">Configuration Advanced Options</a> for more information.</p>
        log_publishing_options: <p>Map of <code>LogType</code> and <code>LogPublishingOption</code>, each containing options to publish a given type of Elasticsearch log.</p>
        domain_endpoint_options: <p>Options to specify configuration that will be applied to the domain endpoint.</p>
        advanced_security_options: <p>Specifies advanced security options.</p>
        auto_tune_options: <p>Specifies Auto-Tune options.</p>
        tag_list: <p>A list of <code>Tag</code> added during domain creation.</p>
        deployment_strategy_options: <p>Specifies the deployment strategy options.</p>
        automated_snapshot_pause_options: <p>Specifies the automated snapshot pause options for the domain.</p> <important> <p>Suspending snapshots reduces data protection. You cannot restore your domain to points in time when snapshots are suspended. Use this feature only for short-term operational needs such as migrations or maintenance windows.</p> </important> <p>Maximum suspension duration: 3 days.</p>
        use_case: <p>The primary use case for the domain. For valid values, see <code>DomainUseCase</code>.</p>
        engine_mode: <p>The engine mode for the domain. For valid values and requirements, see <code>DomainEngineMode</code>.</p>

    Raises:
        capo_elasticsearch_service.errors.base_exception.BaseException: <p>An error occurred while processing the request.</p>
        capo_elasticsearch_service.errors.disabled_operation_exception.DisabledOperationException: <p>An error occured because the client wanted to access a not supported operation. Gives http status code of 409.</p>
        capo_elasticsearch_service.errors.internal_exception.InternalException: <p>The request processing has failed because of an unknown error, exception or failure (the failure is internal to the service) . Gives http status code of 500.</p>
        capo_elasticsearch_service.errors.invalid_type_exception.InvalidTypeException: <p>An exception for trying to create or access sub-resource that is either invalid or not supported. Gives http status code of 409.</p>
        capo_elasticsearch_service.errors.limit_exceeded_exception.LimitExceededException: <p>An exception for trying to create more than allowed resources or sub-resources. Gives http status code of 409.</p>
        capo_elasticsearch_service.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>An exception for creating a resource that already exists. Gives http status code of 400.</p>
        capo_elasticsearch_service.errors.validation_exception.ValidationException: <p>An exception for missing / invalid input fields. Gives http status code of 400.</p>
        capo_elasticsearch_service.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_elasticsearch_service.types.create_elasticsearch_domain_request.CreateElasticsearchDomainRequest]",
    ) -> AsyncOperationResponse[
        "capo_elasticsearch_service.types.create_elasticsearch_domain_response.CreateElasticsearchDomainResponse"
    ]:
        import capo_elasticsearch_service._operations.amazon_elasticsearch_service2015.create_elasticsearch_domain

        (
            output,
            http_response,
        ) = await capo_elasticsearch_service._operations.amazon_elasticsearch_service2015.create_elasticsearch_domain.async_create_elasticsearch_domain(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_elasticsearch_service.types.create_elasticsearch_domain_request.CreateElasticsearchDomainRequest",
    ) -> dict[str, Any]:
        import capo_elasticsearch_service.types.create_elasticsearch_domain_request

        return capo_elasticsearch_service.types.create_elasticsearch_domain_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateElasticsearchDomain", redact_input=_redact_input),
    )
    input_: capo_elasticsearch_service.types.create_elasticsearch_domain_request.CreateElasticsearchDomainRequest = {
        "domain_name": domain_name
    }
    if elasticsearch_version is not None:
        input_["elasticsearch_version"] = elasticsearch_version
    if elasticsearch_cluster_config is not None:
        input_["elasticsearch_cluster_config"] = elasticsearch_cluster_config
    if ebs_options is not None:
        input_["ebs_options"] = ebs_options
    if access_policies is not None:
        input_["access_policies"] = access_policies
    if snapshot_options is not None:
        input_["snapshot_options"] = snapshot_options
    if vpc_options is not None:
        input_["vpc_options"] = vpc_options
    if cognito_options is not None:
        input_["cognito_options"] = cognito_options
    if encryption_at_rest_options is not None:
        input_["encryption_at_rest_options"] = encryption_at_rest_options
    if node_to_node_encryption_options is not None:
        input_["node_to_node_encryption_options"] = node_to_node_encryption_options
    if advanced_options is not None:
        input_["advanced_options"] = advanced_options
    if log_publishing_options is not None:
        input_["log_publishing_options"] = log_publishing_options
    if domain_endpoint_options is not None:
        input_["domain_endpoint_options"] = domain_endpoint_options
    if advanced_security_options is not None:
        input_["advanced_security_options"] = advanced_security_options
    if auto_tune_options is not None:
        input_["auto_tune_options"] = auto_tune_options
    if tag_list is not None:
        input_["tag_list"] = tag_list
    if deployment_strategy_options is not None:
        input_["deployment_strategy_options"] = deployment_strategy_options
    if automated_snapshot_pause_options is not None:
        input_["automated_snapshot_pause_options"] = (
            automated_snapshot_pause_options
        )
    if use_case is not None:
        input_["use_case"] = use_case
    if engine_mode is not None:
        input_["engine_mode"] = engine_mode

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