Skip to content

create_instance async

create_instance(
    *,
    config_overrides: Optional[AsyncSupplyChainClientConfig] = None,
    instance_name: Optional[InstanceName] = None,
    instance_description: Optional[InstanceDescription] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    web_app_dns_domain: Optional[InstanceWebAppDnsDomain] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateInstanceResponse

Enables you to programmatically create an Amazon Web Services Supply Chain instance by applying KMS keys and relevant information associated with the API without using the Amazon Web Services console.

This is an asynchronous operation. Upon receiving a CreateInstance request, Amazon Web Services Supply Chain immediately returns the instance resource, instance ID, and the initializing state while simultaneously creating all required Amazon Web Services resources for an instance creation. You can use GetInstance to check the status of the instance. If the instance results in an unhealthy state, you need to check the error message, delete the current instance, and recreate a new one based on the mitigation from the error message.

Parameters:

  • instance_name (Optional[InstanceName], default: None ) –

    The AWS Supply Chain instance name.

  • instance_description (Optional[InstanceDescription], default: None ) –

    The AWS Supply Chain instance description.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The ARN (Amazon Resource Name) of the Key Management Service (KMS) key you provide for encryption. This is required if you do not want to use the Amazon Web Services owned KMS key. If you don't provide anything here, AWS Supply Chain uses the Amazon Web Services owned KMS key.

  • web_app_dns_domain (Optional[InstanceWebAppDnsDomain], default: None ) –

    The DNS subdomain of the web app. This would be "example" in the URL "example.scn.global.on.aws". You can set this to a custom value, as long as the domain isn't already being used by someone else. The name may only include alphanumeric characters and hyphens.

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

    The Amazon Web Services tags of an instance to be created.

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

    The client token for idempotency.

Raises:

Examples:

Successful CreateInstance request with all input data

>>> await client.create_instance(instance_name='example instance name', instance_description='example instance description', kms_key_arn='arn:aws:kms:us-west-2:123456789012:key/b14ffc39-b7d4-45ab-991a-6257a7f0d24d', tags={'tagKey1': 'tagValue1'})
Successful CreateInstance request with no input data
>>> await client.create_instance()
Source code in docs_src/capo_supplychain/_services/async_supply_chain.py
async def create_instance(
    self,
    *,
    config_overrides: Optional[AsyncSupplyChainClientConfig] = None,
    instance_name: Optional[
        "capo_supplychain.types.instance_name.InstanceName"
    ] = None,
    instance_description: Optional[
        "capo_supplychain.types.instance_description.InstanceDescription"
    ] = None,
    kms_key_arn: Optional["capo_supplychain.types.kms_key_arn.KmsKeyArn"] = None,
    web_app_dns_domain: Optional[
        "capo_supplychain.types.instance_web_app_dns_domain.InstanceWebAppDnsDomain"
    ] = None,
    tags: Optional["capo_supplychain.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_supplychain.types.client_token.ClientToken"
    ] = None,
) -> "capo_supplychain.types.create_instance_response.CreateInstanceResponse":
    """<p>Enables you to programmatically create an Amazon Web Services Supply Chain instance by applying KMS keys and relevant information associated with the API without using the Amazon Web Services console.</p> <p>This is an asynchronous operation. Upon receiving a CreateInstance request, Amazon Web Services Supply Chain immediately returns the instance resource, instance ID, and the initializing state while simultaneously creating all required Amazon Web Services resources for an instance creation. You can use GetInstance to check the status of the instance. If the instance results in an unhealthy state, you need to check the error message, delete the current instance, and recreate a new one based on the mitigation from the error message.</p>

    Args:
        instance_name: <p>The AWS Supply Chain instance name.</p>
        instance_description: <p>The AWS Supply Chain instance description.</p>
        kms_key_arn: <p>The ARN (Amazon Resource Name) of the Key Management Service (KMS) key you provide for encryption. This is required if you do not want to use the Amazon Web Services owned KMS key. If you don't provide anything here, AWS Supply Chain uses the Amazon Web Services owned KMS key.</p>
        web_app_dns_domain: <p>The DNS subdomain of the web app. This would be "example" in the URL "example.scn.global.on.aws". You can set this to a custom value, as long as the domain isn't already being used by someone else. The name may only include alphanumeric characters and hyphens.</p>
        tags: <p>The Amazon Web Services tags of an instance to be created.</p>
        client_token: <p>The client token for idempotency.</p>

    Raises:
        capo_supplychain.errors.access_denied_exception.AccessDeniedException: <p>You do not have the required privileges to perform this action.</p>
        capo_supplychain.errors.conflict_exception.ConflictException: <p>Updating or deleting a resource can cause an inconsistent state.</p>
        capo_supplychain.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of request.</p>
        capo_supplychain.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource which does not exist.</p>
        capo_supplychain.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Request would cause a service quota to be exceeded.</p>
        capo_supplychain.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_supplychain.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an AWS service.</p>
        capo_supplychain.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Successful CreateInstance request with all input data

        >>> await client.create_instance(instance_name='example instance name', instance_description='example instance description', kms_key_arn='arn:aws:kms:us-west-2:123456789012:key/b14ffc39-b7d4-45ab-991a-6257a7f0d24d', tags={'tagKey1': 'tagValue1'})
        Successful CreateInstance request with no input data

        >>> await client.create_instance()
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_supplychain.types.create_instance_request.CreateInstanceRequest]",
    ) -> AsyncOperationResponse[
        "capo_supplychain.types.create_instance_response.CreateInstanceResponse"
    ]:
        import capo_supplychain._operations.galaxy_public_api_gateway.create_instance

        (
            output,
            http_response,
        ) = await capo_supplychain._operations.galaxy_public_api_gateway.create_instance.async_create_instance(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInstance")
    )
    input_: capo_supplychain.types.create_instance_request.CreateInstanceRequest = {}
    if instance_name is not None:
        input_["instance_name"] = instance_name
    if instance_description is not None:
        input_["instance_description"] = instance_description
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if web_app_dns_domain is not None:
        input_["web_app_dns_domain"] = web_app_dns_domain
    if tags is not None:
        input_["tags"] = tags
    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