Skip to content

import_stacks_to_stack_set

import_stacks_to_stack_set(
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_set_name: Optional[StackSetNameOrId] = None,
    stack_ids: Optional[StackIdList] = None,
    stack_ids_url: Optional[StackIdsUrl] = None,
    organizational_unit_ids: Optional[OrganizationalUnitIdList] = None,
    operation_preferences: Optional[StackSetOperationPreferences] = None,
    operation_id: Optional[ClientRequestToken] = None,
    call_as: Optional[CallAs] = None,
) -> ImportStacksToStackSetOutput

Import existing stacks into a new StackSets. Use the stack import operation to import up to 10 stacks into a new StackSet in the same account as the source stack or in a different administrator account and Region, by specifying the stack ID of the stack you intend to import.

Parameters:

  • stack_set_name (Optional[StackSetNameOrId], default: None ) –

    The name of the StackSet. The name must be unique in the Region where you create your StackSet.

  • stack_ids (Optional[StackIdList], default: None ) –

    The IDs of the stacks you are importing into a StackSet. You import up to 10 stacks per StackSet at a time.

    Specify either StackIds or StackIdsUrl.

  • stack_ids_url (Optional[StackIdsUrl], default: None ) –

    The Amazon S3 URL which contains list of stack ids to be inputted.

    Specify either StackIds or StackIdsUrl.

  • organizational_unit_ids (Optional[OrganizationalUnitIdList], default: None ) –

    The list of OU ID's to which the imported stacks must be mapped as deployment targets.

  • operation_preferences (Optional[StackSetOperationPreferences], default: None ) –

    The user-specified preferences for how CloudFormation performs a StackSet operation.

    For more information about maximum concurrent accounts and failure tolerance, see StackSet operation options.

  • operation_id (Optional[ClientRequestToken], default: None ) –

    A unique, user defined, identifier for the StackSet operation.

  • call_as (Optional[CallAs], default: None ) –

    By default, SELF is specified. Use SELF for StackSets with self-managed permissions.

    • If you are signed in to the management account, specify SELF.

    • For service managed StackSets, specify DELEGATED_ADMIN.

Raises:

Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
def import_stacks_to_stack_set(
    self,
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_set_name: Optional[
        "capo_cloudformation.types.stack_set_name_or_id.StackSetNameOrId"
    ] = None,
    stack_ids: Optional[
        "capo_cloudformation.types.stack_id_list.StackIdList"
    ] = None,
    stack_ids_url: Optional[
        "capo_cloudformation.types.stack_ids_url.StackIdsUrl"
    ] = None,
    organizational_unit_ids: Optional[
        "capo_cloudformation.types.organizational_unit_id_list.OrganizationalUnitIdList"
    ] = None,
    operation_preferences: Optional[
        "capo_cloudformation.types.stack_set_operation_preferences.StackSetOperationPreferences"
    ] = None,
    operation_id: Optional[
        "capo_cloudformation.types.client_request_token.ClientRequestToken"
    ] = None,
    call_as: Optional["capo_cloudformation.types.call_as.CallAs"] = None,
) -> "capo_cloudformation.types.import_stacks_to_stack_set_output.ImportStacksToStackSetOutput":
    """<p>Import existing stacks into a new StackSets. Use the stack import operation to import up to 10 stacks into a new StackSet in the same account as the source stack or in a different administrator account and Region, by specifying the stack ID of the stack you intend to import.</p>

    Args:
        stack_set_name: <p>The name of the StackSet. The name must be unique in the Region where you create your StackSet.</p>
        stack_ids: <p>The IDs of the stacks you are importing into a StackSet. You import up to 10 stacks per StackSet at a time.</p> <p>Specify either <code>StackIds</code> or <code>StackIdsUrl</code>.</p>
        stack_ids_url: <p>The Amazon S3 URL which contains list of stack ids to be inputted.</p> <p>Specify either <code>StackIds</code> or <code>StackIdsUrl</code>.</p>
        organizational_unit_ids: <p>The list of OU ID's to which the imported stacks must be mapped as deployment targets.</p>
        operation_preferences: <p>The user-specified preferences for how CloudFormation performs a StackSet operation.</p> <p>For more information about maximum concurrent accounts and failure tolerance, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options">StackSet operation options</a>.</p>
        operation_id: <p>A unique, user defined, identifier for the StackSet operation.</p>
        call_as: <p>By default, <code>SELF</code> is specified. Use <code>SELF</code> for StackSets with self-managed permissions.</p> <ul> <li> <p>If you are signed in to the management account, specify <code>SELF</code>.</p> </li> <li> <p>For service managed StackSets, specify <code>DELEGATED_ADMIN</code>.</p> </li> </ul>

    Raises:
        capo_cloudformation.errors.invalid_operation_exception.InvalidOperationException: <p>The specified operation isn't valid.</p>
        capo_cloudformation.errors.limit_exceeded_exception.LimitExceededException: <p>The quota for the resource has already been reached.</p> <p>For information about resource and stack limitations, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html">CloudFormation quotas</a> in the <i>CloudFormation User Guide</i>.</p>
        capo_cloudformation.errors.operation_id_already_exists_exception.OperationIdAlreadyExistsException: <p>The specified operation ID already exists.</p>
        capo_cloudformation.errors.operation_in_progress_exception.OperationInProgressException: <p>Another operation is currently in progress for this StackSet. Only one operation can be performed for a stack set at a given time.</p>
        capo_cloudformation.errors.stack_not_found_exception.StackNotFoundException: <p>The specified stack ARN doesn't exist or stack doesn't exist corresponding to the ARN in input.</p>
        capo_cloudformation.errors.stack_set_not_found_exception.StackSetNotFoundException: <p>The specified StackSet doesn't exist.</p>
        capo_cloudformation.errors.stale_request_exception.StaleRequestException: <p>Another operation has been performed on this StackSet since the specified operation was performed.</p>
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudformation.types.import_stacks_to_stack_set_input.ImportStacksToStackSetInput]",
    ) -> OperationResponse[
        "capo_cloudformation.types.import_stacks_to_stack_set_output.ImportStacksToStackSetOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.import_stacks_to_stack_set

        output, http_response = (
            capo_cloudformation._operations.cloud_formation.import_stacks_to_stack_set.import_stacks_to_stack_set(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ImportStacksToStackSet")
    )
    input_: capo_cloudformation.types.import_stacks_to_stack_set_input.ImportStacksToStackSetInput = {}
    if stack_set_name is not None:
        input_["stack_set_name"] = stack_set_name
    if stack_ids is not None:
        input_["stack_ids"] = stack_ids
    if stack_ids_url is not None:
        input_["stack_ids_url"] = stack_ids_url
    if organizational_unit_ids is not None:
        input_["organizational_unit_ids"] = organizational_unit_ids
    if operation_preferences is not None:
        input_["operation_preferences"] = operation_preferences
    if operation_id is None:
        operation_id = str(uuid.uuid4())
    input_["operation_id"] = operation_id
    if call_as is not None:
        input_["call_as"] = call_as

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