:doc:`CloudFormation <../../cloudformation>` / Client / create_generated_template

*************************
create_generated_template
*************************



.. py:method:: CloudFormation.Client.create_generated_template(**kwargs)

  

  Creates a template from existing resources that are not already managed with CloudFormation. You can check the status of the template generation using the ``DescribeGeneratedTemplate`` API action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateGeneratedTemplate>`_  


  **Request Syntax**
  ::

    response = client.create_generated_template(
        Resources=[
            {
                'ResourceType': 'string',
                'LogicalResourceId': 'string',
                'ResourceIdentifier': {
                    'string': 'string'
                }
            },
        ],
        GeneratedTemplateName='string',
        StackName='string',
        TemplateConfiguration={
            'DeletionPolicy': 'DELETE'|'RETAIN',
            'UpdateReplacePolicy': 'DELETE'|'RETAIN'
        }
    )
    
  :type Resources: list
  :param Resources: 

    An optional list of resources to be included in the generated template.

     

    If no resources are specified,the template will be created without any resources. Resources can be added to the template using the ``UpdateGeneratedTemplate`` API action.

    

  
    - *(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 `Resource type support for imports and drift detection <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html>`__ 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 <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html#schema-properties-primaryidentifier>`__ in the *CloudFormation Command Line Interface (CLI) User Guide*.

        

      
        - *(string) --* 

        
          - *(string) --* 

          
    
  
    

  :type GeneratedTemplateName: string
  :param GeneratedTemplateName: **[REQUIRED]** 

    The name assigned to the generated template.

    

  
  :type StackName: string
  :param StackName: 

    An optional name or ARN of a stack to use as the base stack for the generated template.

    

  
  :type TemplateConfiguration: dict
  :param TemplateConfiguration: 

    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 <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html>`__ 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 <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html>`__ in the *CloudFormation User Guide*.

      

    
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'GeneratedTemplateId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **GeneratedTemplateId** *(string) --* 

        The ID of the generated template.

        
  
  **Exceptions**
  
  *   :py:class:`CloudFormation.Client.exceptions.AlreadyExistsException`

  
  *   :py:class:`CloudFormation.Client.exceptions.LimitExceededException`

  
  *   :py:class:`CloudFormation.Client.exceptions.ConcurrentResourcesLimitExceededException`

  