Skip to content

create_cluster

create_cluster(
    hsm_type: HsmType,
    subnet_ids: SubnetIds,
    *,
    config_overrides: Optional[CloudHSMV2ClientConfig] = None,
    backup_retention_policy: Optional[BackupRetentionPolicy] = None,
    source_backup_id: Optional[BackupArn] = None,
    network_type: Optional[NetworkType] = None,
    tag_list: Optional[TagList] = None,
    mode: Optional[ClusterMode] = None,
) -> CreateClusterResponse

Creates a new CloudHSM cluster.

Cross-account use: Yes. To perform this operation with an CloudHSM backup in a different AWS account, specify the full backup ARN in the value of the SourceBackupId parameter.

Parameters:

  • backup_retention_policy (Optional[BackupRetentionPolicy], default: None ) –

    A policy that defines how the service retains backups.

  • hsm_type (HsmType) –

    The type of HSM to use in the cluster. The allowed values are hsm1.medium and hsm2m.medium.

  • source_backup_id (Optional[BackupArn], default: None ) –

    The identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use DescribeBackups. If using a backup in another account, the full ARN must be supplied.

  • subnet_ids (SubnetIds) –

    The identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:

    • All subnets must be in the same virtual private cloud (VPC).

    • You can specify only one subnet per Availability Zone.

  • network_type (Optional[NetworkType], default: None ) –

    The NetworkType to create a cluster with. The allowed values are IPV4 and DUALSTACK.

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

    Tags to apply to the CloudHSM cluster during creation.

  • mode (Optional[ClusterMode], default: None ) –

    The mode to use in the cluster. The allowed values are FIPS and NON_FIPS.

Raises:

Source code in docs_src/capo_cloudhsm_v2/_services/cloud_hsmv2.py
def create_cluster(
    self,
    hsm_type: "capo_cloudhsm_v2.types.hsm_type.HsmType",
    subnet_ids: "capo_cloudhsm_v2.types.subnet_ids.SubnetIds",
    *,
    config_overrides: Optional[CloudHSMV2ClientConfig] = None,
    backup_retention_policy: Optional[
        "capo_cloudhsm_v2.types.backup_retention_policy.BackupRetentionPolicy"
    ] = None,
    source_backup_id: Optional[
        "capo_cloudhsm_v2.types.backup_arn.BackupArn"
    ] = None,
    network_type: Optional[
        "capo_cloudhsm_v2.types.network_type.NetworkType"
    ] = None,
    tag_list: Optional["capo_cloudhsm_v2.types.tag_list.TagList"] = None,
    mode: Optional["capo_cloudhsm_v2.types.cluster_mode.ClusterMode"] = None,
) -> "capo_cloudhsm_v2.types.create_cluster_response.CreateClusterResponse":
    """<p>Creates a new CloudHSM cluster.</p> <p> <b>Cross-account use:</b> Yes. To perform this operation with an CloudHSM backup in a different AWS account, specify the full backup ARN in the value of the SourceBackupId parameter.</p>

    Args:
        backup_retention_policy: <p>A policy that defines how the service retains backups.</p>
        hsm_type: <p>The type of HSM to use in the cluster. The allowed values are <code>hsm1.medium</code> and <code>hsm2m.medium</code>.</p>
        source_backup_id: <p>The identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use <a>DescribeBackups</a>. <i>If using a backup in another account, the full ARN must be supplied.</i> </p>
        subnet_ids: <p>The identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:</p> <ul> <li> <p>All subnets must be in the same virtual private cloud (VPC).</p> </li> <li> <p>You can specify only one subnet per Availability Zone.</p> </li> </ul>
        network_type: <p>The NetworkType to create a cluster with. The allowed values are <code>IPV4</code> and <code>DUALSTACK</code>. </p>
        tag_list: <p>Tags to apply to the CloudHSM cluster during creation.</p>
        mode: <p>The mode to use in the cluster. The allowed values are <code>FIPS</code> and <code>NON_FIPS</code>.</p>

    Raises:
        capo_cloudhsm_v2.errors.cloud_hsm_access_denied_exception.CloudHsmAccessDeniedException: <p>The request was rejected because the requester does not have permission to perform the requested operation.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_internal_failure_exception.CloudHsmInternalFailureException: <p>The request was rejected because of an CloudHSM internal failure. The request can be retried.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_invalid_request_exception.CloudHsmInvalidRequestException: <p>The request was rejected because it is not a valid request.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_resource_not_found_exception.CloudHsmResourceNotFoundException: <p>The request was rejected because it refers to a resource that cannot be found.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_service_exception.CloudHsmServiceException: <p>The request was rejected because an error occurred.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_tag_exception.CloudHsmTagException: <p>The request was rejected because of a tagging failure. Verify the tag conditions in all applicable policies, and then retry the request.</p>
        capo_cloudhsm_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudhsm_v2.types.create_cluster_request.CreateClusterRequest]",
    ) -> OperationResponse[
        "capo_cloudhsm_v2.types.create_cluster_response.CreateClusterResponse"
    ]:
        import capo_cloudhsm_v2._operations.baldr_api_service.create_cluster

        output, http_response = (
            capo_cloudhsm_v2._operations.baldr_api_service.create_cluster.create_cluster(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCluster")
    )
    input_: capo_cloudhsm_v2.types.create_cluster_request.CreateClusterRequest = {
        "hsm_type": hsm_type,
        "subnet_ids": subnet_ids,
    }
    if backup_retention_policy is not None:
        input_["backup_retention_policy"] = backup_retention_policy
    if source_backup_id is not None:
        input_["source_backup_id"] = source_backup_id
    if network_type is not None:
        input_["network_type"] = network_type
    if tag_list is not None:
        input_["tag_list"] = tag_list
    if mode is not None:
        input_["mode"] = mode

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