Skip to content

describe_stacks

describe_stacks(
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_name: Optional[StackName] = None,
    next_token: Optional[NextToken] = None,
) -> DescribeStacksOutput

Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks created. For more information about a stack's event history, see Understand CloudFormation stack creation events in the CloudFormation User Guide.

If the stack doesn't exist, a ValidationError is returned.

Parameters:

  • stack_name (Optional[StackName], default: None ) –

    If you don't pass a parameter to StackName, the API returns a response that describes all resources in the account, which can impact performance. This requires ListStacks and DescribeStacks permissions.

    Consider using the ListStacks API if you're not passing a parameter to StackName.

    The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:::stack//" }] }

    The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:

    • Running stacks: You can specify either the stack's name or its unique stack ID.

    • Deleted stacks: You must specify the unique stack ID.

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of items to return. (You received this token from a previous call.)

Raises:

Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
def describe_stacks(
    self,
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_name: Optional["capo_cloudformation.types.stack_name.StackName"] = None,
    next_token: Optional["capo_cloudformation.types.next_token.NextToken"] = None,
) -> "capo_cloudformation.types.describe_stacks_output.DescribeStacksOutput":
    """<p>Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks created. For more information about a stack's event history, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stack-resource-configuration-complete.html">Understand CloudFormation stack creation events</a> in the <i>CloudFormation User Guide</i>.</p> <note> <p>If the stack doesn't exist, a <code>ValidationError</code> is returned.</p> </note>

    Args:
        stack_name: <note> <p>If you don't pass a parameter to <code>StackName</code>, the API returns a response that describes all resources in the account, which can impact performance. This requires <code>ListStacks</code> and <code>DescribeStacks</code> permissions.</p> <p>Consider using the <a>ListStacks</a> API if you're not passing a parameter to <code>StackName</code>.</p> <p>The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:</p> <p>{ "Version": "2012-10-17", "Statement": [{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }] }</p> </note> <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p> <ul> <li> <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p> </li> <li> <p>Deleted stacks: You must specify the unique stack ID.</p> </li> </ul>
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>

    Raises:
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudformation.types.describe_stacks_input.DescribeStacksInput]",
    ) -> OperationResponse[
        "capo_cloudformation.types.describe_stacks_output.DescribeStacksOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.describe_stacks

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeStacks")
    )
    input_: capo_cloudformation.types.describe_stacks_input.DescribeStacksInput = {}
    if stack_name is not None:
        input_["stack_name"] = stack_name
    if next_token is not None:
        input_["next_token"] = next_token

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