AWS CloudFormation

2025/02/06 - AWS CloudFormation - 5 new4 updated api methods

Changes  We added 5 new stack refactoring APIs: CreateStackRefactor, ExecuteStackRefactor, ListStackRefactors, DescribeStackRefactor, ListStackRefactorActions.

ExecuteStackRefactor (new) Link ¶

Executes the stack refactor operation.

See also: AWS API Documentation

Request Syntax

client.execute_stack_refactor(
    StackRefactorId='string'
)
type StackRefactorId:

string

param StackRefactorId:

[REQUIRED]

The ID associated with the stack refactor created from the CreateStackRefactor action.

returns:

None

ListStackRefactors (new) Link ¶

Lists all account stack refactor operations and their statuses.

See also: AWS API Documentation

Request Syntax

client.list_stack_refactors(
    ExecutionStatusFilter=[
        'UNAVAILABLE'|'AVAILABLE'|'OBSOLETE'|'EXECUTE_IN_PROGRESS'|'EXECUTE_COMPLETE'|'EXECUTE_FAILED'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_COMPLETE'|'ROLLBACK_FAILED',
    ],
    NextToken='string',
    MaxResults=123
)
type ExecutionStatusFilter:

list

param ExecutionStatusFilter:

Execution status to use as a filter. Specify one or more execution status codes to list only stack refactors with the specified execution status codes.

  • (string) --

type NextToken:

string

param NextToken:

If the request doesn't return all the remaining results, NextToken is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.

type MaxResults:

integer

param MaxResults:

The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.

rtype:

dict

returns:

Response Syntax

{
    'StackRefactorSummaries': [
        {
            'StackRefactorId': 'string',
            'Description': 'string',
            'ExecutionStatus': 'UNAVAILABLE'|'AVAILABLE'|'OBSOLETE'|'EXECUTE_IN_PROGRESS'|'EXECUTE_COMPLETE'|'EXECUTE_FAILED'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_COMPLETE'|'ROLLBACK_FAILED',
            'ExecutionStatusReason': 'string',
            'Status': 'CREATE_IN_PROGRESS'|'CREATE_COMPLETE'|'CREATE_FAILED'|'DELETE_IN_PROGRESS'|'DELETE_COMPLETE'|'DELETE_FAILED',
            'StatusReason': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • StackRefactorSummaries (list) --

      Provides a summary of a stack refactor, including the following:

      • StackRefactorId

      • Status

      • StatusReason

      • ExecutionStatus

      • ExecutionStatusReason

      • Description

      • (dict) --

        The summary of a stack refactor operation.

        • StackRefactorId (string) --

          The ID associated with the stack refactor created from the CreateStackRefactor action.

        • Description (string) --

          A description to help you identify the refactor.

        • ExecutionStatus (string) --

          The operation status that's provided after calling the ExecuteStackRefactor action.

        • ExecutionStatusReason (string) --

          A detailed explanation for the stack refactor ExecutionStatus.

        • Status (string) --

          The stack refactor operation status that's provided after calling the CreateStackRefactor action.

        • StatusReason (string) --

          A detailed explanation for the stack refactor Status.

    • NextToken (string) --

      If the request doesn't return all the remaining results, NextToken is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.

ListStackRefactorActions (new) Link ¶

Lists the stack refactor actions that will be taken after calling the ExecuteStackRefactor action.

See also: AWS API Documentation

Request Syntax

client.list_stack_refactor_actions(
    StackRefactorId='string',
    NextToken='string',
    MaxResults=123
)
type StackRefactorId:

string

param StackRefactorId:

[REQUIRED]

The ID associated with the stack refactor created from the CreateStackRefactor action.

type NextToken:

string

param NextToken:

If the request doesn't return all the remaining results, NextToken is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.

type MaxResults:

integer

param MaxResults:

The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.

rtype:

dict

returns:

Response Syntax

{
    'StackRefactorActions': [
        {
            'Action': 'MOVE'|'CREATE',
            'Entity': 'RESOURCE'|'STACK',
            'PhysicalResourceId': 'string',
            'ResourceIdentifier': 'string',
            'Description': 'string',
            'Detection': 'AUTO'|'MANUAL',
            'DetectionReason': 'string',
            'TagResources': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'UntagResources': [
                'string',
            ],
            'ResourceMapping': {
                'Source': {
                    'StackName': 'string',
                    'LogicalResourceId': 'string'
                },
                'Destination': {
                    'StackName': 'string',
                    'LogicalResourceId': 'string'
                }
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • StackRefactorActions (list) --

      The stack refactor actions.

      • (dict) --

        Describes the stack and the action that CloudFormation will perform on it if you execute the stack refactor.

        • Action (string) --

          The action that CloudFormation takes on the stack.

        • Entity (string) --

          The type that will be evaluated in the StackRefactorAction. The following are potential Entity types:

          • Stack

          • Resource

        • PhysicalResourceId (string) --

          The name or unique identifier associated with the physical instance of the resource.

        • ResourceIdentifier (string) --

          A key-value pair that identifies the target resource. The key is an identifier property (for example, BucketName for AWS::S3::Bucket resources) and the value is the actual property value (for example, MyS3Bucket).

        • Description (string) --

          A description to help you identify the refactor.

        • Detection (string) --

          The detection type is one of the following:

          • Auto: CloudFormation figured out the mapping on its own.

          • Manual: The customer provided the mapping in the ResourceMapping parameter.

        • DetectionReason (string) --

          The description of the detection type.

        • TagResources (list) --

          Assigns one or more tags to specified resources.

          • (dict) --

            The Tag type enables you to specify a key-value pair that can be used to store information about an CloudFormation stack.

            • Key (string) --

              Required. A string used to identify this tag. You can specify a maximum of 128 characters for a tag key. Tags owned by Amazon Web Services have the reserved prefix: aws:.

            • Value (string) --

              Required. A string containing the value for this tag. You can specify a maximum of 256 characters for a tag value.

        • UntagResources (list) --

          Removes one or more tags to specified resources.

          • (string) --

        • ResourceMapping (dict) --

          The mapping for the stack resource Source and stack resource Destination.

          • Source (dict) --

            The source stack StackName and LogicalResourceId for the resource being refactored.

            • StackName (string) --

              The name associated with the stack.

            • LogicalResourceId (string) --

              The logical name of the resource specified in the template.

          • Destination (dict) --

            The destination stack StackName and LogicalResourceId for the resource being refactored.

            • StackName (string) --

              The name associated with the stack.

            • LogicalResourceId (string) --

              The logical name of the resource specified in the template.

    • NextToken (string) --

      If the request doesn't return all the remaining results, NextToken is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.

DescribeStackRefactor (new) Link ¶

Describes the stack refactor status.

See also: AWS API Documentation

Request Syntax

client.describe_stack_refactor(
    StackRefactorId='string'
)
type StackRefactorId:

string

param StackRefactorId:

[REQUIRED]

The ID associated with the stack refactor created from the CreateStackRefactor action.

rtype:

dict

returns:

Response Syntax

{
    'Description': 'string',
    'StackRefactorId': 'string',
    'StackIds': [
        'string',
    ],
    'ExecutionStatus': 'UNAVAILABLE'|'AVAILABLE'|'OBSOLETE'|'EXECUTE_IN_PROGRESS'|'EXECUTE_COMPLETE'|'EXECUTE_FAILED'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_COMPLETE'|'ROLLBACK_FAILED',
    'ExecutionStatusReason': 'string',
    'Status': 'CREATE_IN_PROGRESS'|'CREATE_COMPLETE'|'CREATE_FAILED'|'DELETE_IN_PROGRESS'|'DELETE_COMPLETE'|'DELETE_FAILED',
    'StatusReason': 'string'
}

Response Structure

  • (dict) --

    • Description (string) --

      A description to help you identify the refactor.

    • StackRefactorId (string) --

      The ID associated with the stack refactor created from the CreateStackRefactor action.

    • StackIds (list) --

      The unique ID for each stack.

      • (string) --

    • ExecutionStatus (string) --

      The stack refactor execution operation status that's provided after calling the ExecuteStackRefactor action.

    • ExecutionStatusReason (string) --

      A detailed explanation for the stack refactor ExecutionStatus.

    • Status (string) --

      The stack refactor operation status that's provided after calling the CreateStackRefactor action.

    • StatusReason (string) --

      A detailed explanation for the stack refactor operation Status.

CreateStackRefactor (new) Link ¶

Creates a refactor across multiple stacks, with the list of stacks and resources that are affected.

See also: AWS API Documentation

Request Syntax

client.create_stack_refactor(
    Description='string',
    EnableStackCreation=True|False,
    ResourceMappings=[
        {
            'Source': {
                'StackName': 'string',
                'LogicalResourceId': 'string'
            },
            'Destination': {
                'StackName': 'string',
                'LogicalResourceId': 'string'
            }
        },
    ],
    StackDefinitions=[
        {
            'StackName': 'string',
            'TemplateBody': 'string',
            'TemplateURL': 'string'
        },
    ]
)
type Description:

string

param Description:

A description to help you identify the stack refactor.

type EnableStackCreation:

boolean

param EnableStackCreation:

Determines if a new stack is created with the refactor.

type ResourceMappings:

list

param ResourceMappings:

The mappings for the stack resource Source and stack resource Destination.

  • (dict) --

    Specifies the current source of the resource and the destination of where it will be moved to.

    • Source (dict) -- [REQUIRED]

      The source stack StackName and LogicalResourceId for the resource being refactored.

      • StackName (string) -- [REQUIRED]

        The name associated with the stack.

      • LogicalResourceId (string) -- [REQUIRED]

        The logical name of the resource specified in the template.

    • Destination (dict) -- [REQUIRED]

      The destination stack StackName and LogicalResourceId for the resource being refactored.

      • StackName (string) -- [REQUIRED]

        The name associated with the stack.

      • LogicalResourceId (string) -- [REQUIRED]

        The logical name of the resource specified in the template.

type StackDefinitions:

list

param StackDefinitions:

[REQUIRED]

The stacks being refactored.

  • (dict) --

    Describes the stack and the template used by the stack.

    • StackName (string) --

      The name associated with the stack.

    • TemplateBody (string) --

      The file path for the stack template file.

    • TemplateURL (string) --

      The desired final state of the stack template.

rtype:

dict

returns:

Response Syntax

{
    'StackRefactorId': 'string'
}

Response Structure

  • (dict) --

    • StackRefactorId (string) --

      The ID associated with the stack refactor created from the CreateStackRefactor action.

DescribeStackEvents (updated) Link ¶
Changes (response)
{'StackEvents': {'ResourceStatus': {'EXPORT_COMPLETE',
                                    'EXPORT_FAILED',
                                    'EXPORT_IN_PROGRESS',
                                    'EXPORT_ROLLBACK_COMPLETE',
                                    'EXPORT_ROLLBACK_FAILED',
                                    'EXPORT_ROLLBACK_IN_PROGRESS'}}}

Returns all stack related events for a specified stack in reverse chronological order. For more information about a stack's event history, see Understand CloudFormation stack creation events in the CloudFormation User Guide.

See also: AWS API Documentation

Request Syntax

client.describe_stack_events(
    StackName='string',
    NextToken='string'
)
type StackName:

string

param StackName:

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.

Default: There is no default value.

type NextToken:

string

param NextToken:

A string that identifies the next page of events that you want to retrieve.

rtype:

dict

returns:

Response Syntax

{
    'StackEvents': [
        {
            'StackId': 'string',
            'EventId': 'string',
            'StackName': 'string',
            'LogicalResourceId': 'string',
            'PhysicalResourceId': 'string',
            'ResourceType': 'string',
            'Timestamp': datetime(2015, 1, 1),
            'ResourceStatus': 'CREATE_IN_PROGRESS'|'CREATE_FAILED'|'CREATE_COMPLETE'|'DELETE_IN_PROGRESS'|'DELETE_FAILED'|'DELETE_COMPLETE'|'DELETE_SKIPPED'|'UPDATE_IN_PROGRESS'|'UPDATE_FAILED'|'UPDATE_COMPLETE'|'IMPORT_FAILED'|'IMPORT_COMPLETE'|'IMPORT_IN_PROGRESS'|'IMPORT_ROLLBACK_IN_PROGRESS'|'IMPORT_ROLLBACK_FAILED'|'IMPORT_ROLLBACK_COMPLETE'|'EXPORT_FAILED'|'EXPORT_COMPLETE'|'EXPORT_IN_PROGRESS'|'EXPORT_ROLLBACK_IN_PROGRESS'|'EXPORT_ROLLBACK_FAILED'|'EXPORT_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_IN_PROGRESS'|'UPDATE_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_FAILED'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_COMPLETE'|'ROLLBACK_FAILED',
            'ResourceStatusReason': 'string',
            'ResourceProperties': 'string',
            'ClientRequestToken': 'string',
            'HookType': 'string',
            'HookStatus': 'HOOK_IN_PROGRESS'|'HOOK_COMPLETE_SUCCEEDED'|'HOOK_COMPLETE_FAILED'|'HOOK_FAILED',
            'HookStatusReason': 'string',
            'HookInvocationPoint': 'PRE_PROVISION',
            'HookFailureMode': 'FAIL'|'WARN',
            'DetailedStatus': 'CONFIGURATION_COMPLETE'|'VALIDATION_FAILED'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    The output for a DescribeStackEvents action.

    • StackEvents (list) --

      A list of StackEvents structures.

      • (dict) --

        The StackEvent data type.

        • StackId (string) --

          The unique ID name of the instance of the stack.

        • EventId (string) --

          The unique ID of this event.

        • StackName (string) --

          The name associated with a stack.

        • LogicalResourceId (string) --

          The logical name of the resource specified in the template.

        • PhysicalResourceId (string) --

          The name or unique identifier associated with the physical instance of the resource.

        • ResourceType (string) --

          Type of resource. For more information, see Amazon Web Services resource and property types reference in the CloudFormation User Guide.

        • Timestamp (datetime) --

          Time the status was updated.

        • ResourceStatus (string) --

          Current status of the resource.

        • ResourceStatusReason (string) --

          Success/failure message associated with the resource.

        • ResourceProperties (string) --

          BLOB of the properties used to create the resource.

        • ClientRequestToken (string) --

          The token passed to the operation that generated this event.

          All events triggered by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a CreateStack operation with the token token1, then all the StackEvents generated by that operation will have ClientRequestToken set as token1.

          In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.

        • HookType (string) --

          The name of the hook.

        • HookStatus (string) --

          Provides the status of the change set hook.

        • HookStatusReason (string) --

          Provides the reason for the hook status.

        • HookInvocationPoint (string) --

          Invocation points are points in provisioning logic where Hooks are initiated.

        • HookFailureMode (string) --

          Specify the hook failure mode for non-compliant resources in the followings ways.

          • FAIL Stops provisioning resources.

          • WARN Allows provisioning to continue with a warning message.

        • DetailedStatus (string) --

          An optional field containing information about the detailed status of the stack event.

          • CONFIGURATION_COMPLETE - all of the resources in the stack have reached that event. For more information, see Understand CloudFormation stack creation events in the CloudFormation User Guide.

          • VALIDATION_FAILED - template validation failed because of invalid properties in the template. The ResourceStatusReason field shows what properties are defined incorrectly.

    • NextToken (string) --

      If the output exceeds 1 MB in size, a string that identifies the next page of events. If no additional page exists, this value is null.

DescribeStackResource (updated) Link ¶
Changes (response)
{'StackResourceDetail': {'ResourceStatus': {'EXPORT_COMPLETE',
                                            'EXPORT_FAILED',
                                            'EXPORT_IN_PROGRESS',
                                            'EXPORT_ROLLBACK_COMPLETE',
                                            'EXPORT_ROLLBACK_FAILED',
                                            'EXPORT_ROLLBACK_IN_PROGRESS'}}}

Returns a description of the specified resource in the specified stack.

For deleted stacks, DescribeStackResource returns resource information for up to 90 days after the stack has been deleted.

See also: AWS API Documentation

Request Syntax

client.describe_stack_resource(
    StackName='string',
    LogicalResourceId='string'
)
type StackName:

string

param StackName:

[REQUIRED]

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.

Default: There is no default value.

type LogicalResourceId:

string

param LogicalResourceId:

[REQUIRED]

The logical name of the resource as specified in the template.

Default: There is no default value.

rtype:

dict

returns:

Response Syntax

{
    'StackResourceDetail': {
        'StackName': 'string',
        'StackId': 'string',
        'LogicalResourceId': 'string',
        'PhysicalResourceId': 'string',
        'ResourceType': 'string',
        'LastUpdatedTimestamp': datetime(2015, 1, 1),
        'ResourceStatus': 'CREATE_IN_PROGRESS'|'CREATE_FAILED'|'CREATE_COMPLETE'|'DELETE_IN_PROGRESS'|'DELETE_FAILED'|'DELETE_COMPLETE'|'DELETE_SKIPPED'|'UPDATE_IN_PROGRESS'|'UPDATE_FAILED'|'UPDATE_COMPLETE'|'IMPORT_FAILED'|'IMPORT_COMPLETE'|'IMPORT_IN_PROGRESS'|'IMPORT_ROLLBACK_IN_PROGRESS'|'IMPORT_ROLLBACK_FAILED'|'IMPORT_ROLLBACK_COMPLETE'|'EXPORT_FAILED'|'EXPORT_COMPLETE'|'EXPORT_IN_PROGRESS'|'EXPORT_ROLLBACK_IN_PROGRESS'|'EXPORT_ROLLBACK_FAILED'|'EXPORT_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_IN_PROGRESS'|'UPDATE_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_FAILED'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_COMPLETE'|'ROLLBACK_FAILED',
        'ResourceStatusReason': 'string',
        'Description': 'string',
        'Metadata': 'string',
        'DriftInformation': {
            'StackResourceDriftStatus': 'IN_SYNC'|'MODIFIED'|'DELETED'|'NOT_CHECKED',
            'LastCheckTimestamp': datetime(2015, 1, 1)
        },
        'ModuleInfo': {
            'TypeHierarchy': 'string',
            'LogicalIdHierarchy': 'string'
        }
    }
}

Response Structure

  • (dict) --

    The output for a DescribeStackResource action.

    • StackResourceDetail (dict) --

      A StackResourceDetail structure containing the description of the specified resource in the specified stack.

      • StackName (string) --

        The name associated with the stack.

      • StackId (string) --

        Unique identifier of the stack.

      • LogicalResourceId (string) --

        The logical name of the resource specified in the template.

      • PhysicalResourceId (string) --

        The name or unique identifier that corresponds to a physical instance ID of a resource supported by CloudFormation.

      • ResourceType (string) --

        Type of resource. For more information, see Amazon Web Services resource and property types reference in the CloudFormation User Guide.

      • LastUpdatedTimestamp (datetime) --

        Time the status was updated.

      • ResourceStatus (string) --

        Current status of the resource.

      • ResourceStatusReason (string) --

        Success/failure message associated with the resource.

      • Description (string) --

        User defined description associated with the resource.

      • Metadata (string) --

        The content of the Metadata attribute declared for the resource. For more information, see Metadata attribute in the CloudFormation User Guide.

      • DriftInformation (dict) --

        Information about whether the resource's actual configuration differs, or has drifted, from its expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detect unmanaged configuration changes to stacks and resources with drift detection.

        • StackResourceDriftStatus (string) --

          Status of the resource's actual configuration compared to its expected configuration

          • DELETED: The resource differs from its expected configuration in that it has been deleted.

          • MODIFIED: The resource differs from its expected configuration.

          • NOT_CHECKED: CloudFormation has not checked if the resource differs from its expected configuration. Any resources that do not currently support drift detection have a status of NOT_CHECKED. For more information, see Resource type support for imports and drift detection.

          • IN_SYNC: The resource's actual configuration matches its expected configuration.

        • LastCheckTimestamp (datetime) --

          When CloudFormation last checked if the resource had drifted from its expected configuration.

      • ModuleInfo (dict) --

        Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.

        • TypeHierarchy (string) --

          A concatenated list of the module type or types containing the resource. Module types are listed starting with the inner-most nested module, and separated by /.

          In the following example, the resource was created from a module of type AWS::First::Example::MODULE, that's nested inside a parent module of type AWS::Second::Example::MODULE.

          AWS::First::Example::MODULE/AWS::Second::Example::MODULE

        • LogicalIdHierarchy (string) --

          A concatenated list of the logical IDs of the module or modules containing the resource. Modules are listed starting with the inner-most nested module, and separated by /.

          In the following example, the resource was created from a module, moduleA, that's nested inside a parent module, moduleB.

          moduleA/moduleB

          For more information, see Reference module resources in CloudFormation templates in the CloudFormation User Guide.

DescribeStackResources (updated) Link ¶
Changes (response)
{'StackResources': {'ResourceStatus': {'EXPORT_COMPLETE',
                                       'EXPORT_FAILED',
                                       'EXPORT_IN_PROGRESS',
                                       'EXPORT_ROLLBACK_COMPLETE',
                                       'EXPORT_ROLLBACK_FAILED',
                                       'EXPORT_ROLLBACK_IN_PROGRESS'}}}

Returns Amazon Web Services resource descriptions for running and deleted stacks. If StackName is specified, all the associated resources that are part of the stack are returned. If PhysicalResourceId is specified, the associated resources of the stack that the resource belongs to are returned.

For deleted stacks, DescribeStackResources returns resource information for up to 90 days after the stack has been deleted.

You must specify either StackName or PhysicalResourceId, but not both. In addition, you can specify LogicalResourceId to filter the returned result. For more information about resources, the LogicalResourceId and PhysicalResourceId, see the CloudFormation User Guide.

See also: AWS API Documentation

Request Syntax

client.describe_stack_resources(
    StackName='string',
    LogicalResourceId='string',
    PhysicalResourceId='string'
)
type StackName:

string

param StackName:

The name or the unique stack ID that is 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.

Default: There is no default value.

Required: Conditional. If you don't specify StackName, you must specify PhysicalResourceId.

type LogicalResourceId:

string

param LogicalResourceId:

The logical name of the resource as specified in the template.

Default: There is no default value.

type PhysicalResourceId:

string

param PhysicalResourceId:

The name or unique identifier that corresponds to a physical instance ID of a resource supported by CloudFormation.

For example, for an Amazon Elastic Compute Cloud (EC2) instance, PhysicalResourceId corresponds to the InstanceId. You can pass the EC2 InstanceId to DescribeStackResources to find which stack the instance belongs to and what other resources are part of the stack.

Required: Conditional. If you don't specify PhysicalResourceId, you must specify StackName.

Default: There is no default value.

rtype:

dict

returns:

Response Syntax

{
    'StackResources': [
        {
            'StackName': 'string',
            'StackId': 'string',
            'LogicalResourceId': 'string',
            'PhysicalResourceId': 'string',
            'ResourceType': 'string',
            'Timestamp': datetime(2015, 1, 1),
            'ResourceStatus': 'CREATE_IN_PROGRESS'|'CREATE_FAILED'|'CREATE_COMPLETE'|'DELETE_IN_PROGRESS'|'DELETE_FAILED'|'DELETE_COMPLETE'|'DELETE_SKIPPED'|'UPDATE_IN_PROGRESS'|'UPDATE_FAILED'|'UPDATE_COMPLETE'|'IMPORT_FAILED'|'IMPORT_COMPLETE'|'IMPORT_IN_PROGRESS'|'IMPORT_ROLLBACK_IN_PROGRESS'|'IMPORT_ROLLBACK_FAILED'|'IMPORT_ROLLBACK_COMPLETE'|'EXPORT_FAILED'|'EXPORT_COMPLETE'|'EXPORT_IN_PROGRESS'|'EXPORT_ROLLBACK_IN_PROGRESS'|'EXPORT_ROLLBACK_FAILED'|'EXPORT_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_IN_PROGRESS'|'UPDATE_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_FAILED'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_COMPLETE'|'ROLLBACK_FAILED',
            'ResourceStatusReason': 'string',
            'Description': 'string',
            'DriftInformation': {
                'StackResourceDriftStatus': 'IN_SYNC'|'MODIFIED'|'DELETED'|'NOT_CHECKED',
                'LastCheckTimestamp': datetime(2015, 1, 1)
            },
            'ModuleInfo': {
                'TypeHierarchy': 'string',
                'LogicalIdHierarchy': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) --

    The output for a DescribeStackResources action.

    • StackResources (list) --

      A list of StackResource structures.

      • (dict) --

        The StackResource data type.

        • StackName (string) --

          The name associated with the stack.

        • StackId (string) --

          Unique identifier of the stack.

        • LogicalResourceId (string) --

          The logical name of the resource specified in the template.

        • PhysicalResourceId (string) --

          The name or unique identifier that corresponds to a physical instance ID of a resource supported by CloudFormation.

        • ResourceType (string) --

          Type of resource. For more information, see Amazon Web Services resource and property types reference in the CloudFormation User Guide.

        • Timestamp (datetime) --

          Time the status was updated.

        • ResourceStatus (string) --

          Current status of the resource.

        • ResourceStatusReason (string) --

          Success/failure message associated with the resource.

        • Description (string) --

          User defined description associated with the resource.

        • DriftInformation (dict) --

          Information about whether the resource's actual configuration differs, or has drifted, from its expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detect unmanaged configuration changes to stacks and resources with drift detection.

          • StackResourceDriftStatus (string) --

            Status of the resource's actual configuration compared to its expected configuration

            • DELETED: The resource differs from its expected configuration in that it has been deleted.

            • MODIFIED: The resource differs from its expected configuration.

            • NOT_CHECKED: CloudFormation has not checked if the resource differs from its expected configuration. Any resources that do not currently support drift detection have a status of NOT_CHECKED. For more information, see Resource type support for imports and drift detection.

            • IN_SYNC: The resource's actual configuration matches its expected configuration.

          • LastCheckTimestamp (datetime) --

            When CloudFormation last checked if the resource had drifted from its expected configuration.

        • ModuleInfo (dict) --

          Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.

          • TypeHierarchy (string) --

            A concatenated list of the module type or types containing the resource. Module types are listed starting with the inner-most nested module, and separated by /.

            In the following example, the resource was created from a module of type AWS::First::Example::MODULE, that's nested inside a parent module of type AWS::Second::Example::MODULE.

            AWS::First::Example::MODULE/AWS::Second::Example::MODULE

          • LogicalIdHierarchy (string) --

            A concatenated list of the logical IDs of the module or modules containing the resource. Modules are listed starting with the inner-most nested module, and separated by /.

            In the following example, the resource was created from a module, moduleA, that's nested inside a parent module, moduleB.

            moduleA/moduleB

            For more information, see Reference module resources in CloudFormation templates in the CloudFormation User Guide.

ListStackResources (updated) Link ¶
Changes (response)
{'StackResourceSummaries': {'ResourceStatus': {'EXPORT_COMPLETE',
                                               'EXPORT_FAILED',
                                               'EXPORT_IN_PROGRESS',
                                               'EXPORT_ROLLBACK_COMPLETE',
                                               'EXPORT_ROLLBACK_FAILED',
                                               'EXPORT_ROLLBACK_IN_PROGRESS'}}}

Returns descriptions of all resources of the specified stack.

For deleted stacks, ListStackResources returns resource information for up to 90 days after the stack has been deleted.

See also: AWS API Documentation

Request Syntax

client.list_stack_resources(
    StackName='string',
    NextToken='string'
)
type StackName:

string

param StackName:

[REQUIRED]

The name or the unique stack ID that is 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.

Default: There is no default value.

type NextToken:

string

param NextToken:

A string that identifies the next page of stack resources that you want to retrieve.

rtype:

dict

returns:

Response Syntax

{
    'StackResourceSummaries': [
        {
            'LogicalResourceId': 'string',
            'PhysicalResourceId': 'string',
            'ResourceType': 'string',
            'LastUpdatedTimestamp': datetime(2015, 1, 1),
            'ResourceStatus': 'CREATE_IN_PROGRESS'|'CREATE_FAILED'|'CREATE_COMPLETE'|'DELETE_IN_PROGRESS'|'DELETE_FAILED'|'DELETE_COMPLETE'|'DELETE_SKIPPED'|'UPDATE_IN_PROGRESS'|'UPDATE_FAILED'|'UPDATE_COMPLETE'|'IMPORT_FAILED'|'IMPORT_COMPLETE'|'IMPORT_IN_PROGRESS'|'IMPORT_ROLLBACK_IN_PROGRESS'|'IMPORT_ROLLBACK_FAILED'|'IMPORT_ROLLBACK_COMPLETE'|'EXPORT_FAILED'|'EXPORT_COMPLETE'|'EXPORT_IN_PROGRESS'|'EXPORT_ROLLBACK_IN_PROGRESS'|'EXPORT_ROLLBACK_FAILED'|'EXPORT_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_IN_PROGRESS'|'UPDATE_ROLLBACK_COMPLETE'|'UPDATE_ROLLBACK_FAILED'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_COMPLETE'|'ROLLBACK_FAILED',
            'ResourceStatusReason': 'string',
            'DriftInformation': {
                'StackResourceDriftStatus': 'IN_SYNC'|'MODIFIED'|'DELETED'|'NOT_CHECKED',
                'LastCheckTimestamp': datetime(2015, 1, 1)
            },
            'ModuleInfo': {
                'TypeHierarchy': 'string',
                'LogicalIdHierarchy': 'string'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    The output for a ListStackResources action.

    • StackResourceSummaries (list) --

      A list of StackResourceSummary structures.

      • (dict) --

        Contains high-level information about the specified stack resource.

        • LogicalResourceId (string) --

          The logical name of the resource specified in the template.

        • PhysicalResourceId (string) --

          The name or unique identifier that corresponds to a physical instance ID of the resource.

        • ResourceType (string) --

          Type of resource. (For more information, see Amazon Web Services resource and property types reference in the CloudFormation User Guide.)

        • LastUpdatedTimestamp (datetime) --

          Time the status was updated.

        • ResourceStatus (string) --

          Current status of the resource.

        • ResourceStatusReason (string) --

          Success/failure message associated with the resource.

        • DriftInformation (dict) --

          Information about whether the resource's actual configuration differs, or has drifted, from its expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detect unmanaged configuration changes to stacks and resources with drift detection.

          • StackResourceDriftStatus (string) --

            Status of the resource's actual configuration compared to its expected configuration.

            • DELETED: The resource differs from its expected configuration in that it has been deleted.

            • MODIFIED: The resource differs from its expected configuration.

            • NOT_CHECKED: CloudFormation hasn't checked if the resource differs from its expected configuration. Any resources that don't currently support drift detection have a status of NOT_CHECKED. For more information, see Resource type support for imports and drift detection. If you performed an ContinueUpdateRollback operation on a stack, any resources included in ResourcesToSkip will also have a status of NOT_CHECKED. For more information about skipping resources during rollback operations, see Continue rolling back an update in the CloudFormation User Guide.

            • IN_SYNC: The resource's actual configuration matches its expected configuration.

          • LastCheckTimestamp (datetime) --

            When CloudFormation last checked if the resource had drifted from its expected configuration.

        • ModuleInfo (dict) --

          Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.

          • TypeHierarchy (string) --

            A concatenated list of the module type or types containing the resource. Module types are listed starting with the inner-most nested module, and separated by /.

            In the following example, the resource was created from a module of type AWS::First::Example::MODULE, that's nested inside a parent module of type AWS::Second::Example::MODULE.

            AWS::First::Example::MODULE/AWS::Second::Example::MODULE

          • LogicalIdHierarchy (string) --

            A concatenated list of the logical IDs of the module or modules containing the resource. Modules are listed starting with the inner-most nested module, and separated by /.

            In the following example, the resource was created from a module, moduleA, that's nested inside a parent module, moduleB.

            moduleA/moduleB

            For more information, see Reference module resources in CloudFormation templates in the CloudFormation User Guide.

    • NextToken (string) --

      If the output exceeds 1 MB, a string that identifies the next page of stack resources. If no additional page exists, this value is null.