ServiceResource / Collection / stacks

stacks

CloudFormation.ServiceResource.stacks

A collection of Stack resources.A Stack Collection will include all resources by default, and extreme caution should be taken when performing actions on all resources.

all()

Creates an iterable of all Stack resources in the collection.

See also: AWS API Documentation

Request Syntax

stack_iterator = cloudformation.stacks.all()
Return type:

list(cloudformation.Stack)

Returns:

A list of Stack resources

filter(**kwargs)

Creates an iterable of all Stack resources in the collection filtered by kwargs passed to method. A Stack collection will include all resources by default if no filters are provided, and extreme caution should be taken when performing actions on all resources.

See also: AWS API Documentation

Request Syntax

stack_iterator = cloudformation.stacks.filter(
    StackName='string',
    NextToken='string'
)
Parameters:
  • StackName (string) –

    Note

    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.

  • NextToken (string) – A string that identifies the next page of stacks that you want to retrieve.

Return type:

list(cloudformation.Stack)

Returns:

A list of Stack resources

limit(**kwargs)

Creates an iterable up to a specified amount of Stack resources in the collection.

See also: AWS API Documentation

Request Syntax

stack_iterator = cloudformation.stacks.limit(
    count=123
)
Parameters:

count (integer) – The limit to the number of resources in the iterable.

Return type:

list(cloudformation.Stack)

Returns:

A list of Stack resources

page_size(**kwargs)

Creates an iterable of all Stack resources in the collection, but limits the number of items returned by each service call by the specified amount.

See also: AWS API Documentation

Request Syntax

stack_iterator = cloudformation.stacks.page_size(
    count=123
)
Parameters:

count (integer) – The number of items returned by each service call

Return type:

list(cloudformation.Stack)

Returns:

A list of Stack resources