CloudFormation / Client / update_generated_template



Updates a generated template. This can be used to change the name, add and remove resources, refresh resources, and change the DeletionPolicy and UpdateReplacePolicy settings. You can check the status of the update to the generated template using the DescribeGeneratedTemplate API action.

See also: AWS API Documentation

Request Syntax

response = client.update_generated_template(
            'ResourceType': 'string',
            'LogicalResourceId': 'string',
            'ResourceIdentifier': {
                'string': 'string'
        'DeletionPolicy': 'DELETE'|'RETAIN',
        'UpdateReplacePolicy': 'DELETE'|'RETAIN'
  • GeneratedTemplateName (string) –


    The name or Amazon Resource Name (ARN) of a generated template.

  • NewGeneratedTemplateName (string) – An optional new name to assign to the generated template.

  • AddResources (list) –

    An optional list of resources to be added to the generated template.

    • (dict) –

      A resource included in a generated template. This data type is used with the CreateGeneratedTemplate and UpdateGeneratedTemplate API actions.

      • ResourceType (string) – [REQUIRED]

        The type of the resource, such as AWS::DynamoDB::Table. For the list of supported resources, see IaC generator supported resource types in the CloudFormation User Guide

      • LogicalResourceId (string) –

        The logical resource id for this resource in the generated template.

      • ResourceIdentifier (dict) – [REQUIRED]

        A list of up to 256 key-value pairs that identifies the scanned resource. The key is the name of one of the primary identifiers for the resource. (Primary identifiers are specified in the primaryIdentifier list in the resource schema.) The value is the value of that primary identifier. For example, for a AWS::DynamoDB::Table resource, the primary identifiers is TableName so the key-value pair could be "TableName": "MyDDBTable". For more information, see primaryIdentifier in the CloudFormation Command Line Interface User guide for extension development.

        • (string) –

          • (string) –

  • RemoveResources (list) –

    A list of logical ids for resources to remove from the generated template.

    • (string) –

  • RefreshAllResources (boolean) – If true, update the resource properties in the generated template with their current live state. This feature is useful when the resource properties in your generated a template does not reflect the live state of the resource properties. This happens when a user update the resource properties after generating a template.

  • TemplateConfiguration (dict) –

    The configuration details of the generated template, including the DeletionPolicy and UpdateReplacePolicy.

    • DeletionPolicy (string) –

      The DeletionPolicy assigned to resources in the generated template. Supported values are:

      • DELETE - delete all resources when the stack is deleted.

      • RETAIN - retain all resources when the stack is deleted.

      For more information, see DeletionPolicy attribute in the CloudFormation User Guide.

    • UpdateReplacePolicy (string) –

      The UpdateReplacePolicy assigned to resources in the generated template. Supported values are:

      • DELETE - delete all resources when the resource is replaced during an update operation.

      • RETAIN - retain all resources when the resource is replaced during an update operation.

      For more information, see UpdateReplacePolicy attribute in the CloudFormation User Guide.

Return type:



Response Syntax

    'GeneratedTemplateId': 'string'

Response Structure

  • (dict) –

    • GeneratedTemplateId (string) –

      The Amazon Resource Name (ARN) of the generated template. The format is arn:${Partition}:cloudformation:${Region}:${Account}:generatedtemplate/${Id}. For example, ``arn:aws:cloudformation:us-east-1:123456789012:generatedtemplate/2e8465c1-9a80-43ea-a3a3-4f2d692fe6dc ``.


  • CloudFormation.Client.exceptions.AlreadyExistsException

  • CloudFormation.Client.exceptions.GeneratedTemplateNotFoundException

  • CloudFormation.Client.exceptions.LimitExceededException