:doc:`EC2 <../../ec2>` / Client / describe_image_references

*************************
describe_image_references
*************************



.. py:method:: EC2.Client.describe_image_references(**kwargs)

  

  Describes your Amazon Web Services resources that are referencing the specified images.

   

  For more information, see `Identify your resources referencing specified AMIs <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-ami-references.html>`__ in the *Amazon EC2 User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeImageReferences>`_  


  **Request Syntax**
  ::

    response = client.describe_image_references(
        ImageIds=[
            'string',
        ],
        IncludeAllResourceTypes=True|False,
        ResourceTypes=[
            {
                'ResourceType': 'ec2:Instance'|'ec2:LaunchTemplate'|'ssm:Parameter'|'imagebuilder:ImageRecipe'|'imagebuilder:ContainerRecipe',
                'ResourceTypeOptions': [
                    {
                        'OptionName': 'state-name'|'version-depth',
                        'OptionValues': [
                            'string',
                        ]
                    },
                ]
            },
        ],
        NextToken='string',
        DryRun=True|False,
        MaxResults=123
    )
    
  :type ImageIds: list
  :param ImageIds: **[REQUIRED]** 

    The IDs of the images to check for resource references.

    

  
    - *(string) --* 

    

  :type IncludeAllResourceTypes: boolean
  :param IncludeAllResourceTypes: 

    Specifies whether to check all supported Amazon Web Services resource types for image references. When specified, default values are applied for ``ResourceTypeOptions``. For the default values, see `How AMI reference checks work <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-ami-references.html#how-ami-references-works>`__ in the *Amazon EC2 User Guide*. If you also specify ``ResourceTypes`` with ``ResourceTypeOptions``, your specified values override the default values.

     

    Supported resource types: ``ec2:Instance`` | ``ec2:LaunchTemplate`` | ``ssm:Parameter`` | ``imagebuilder:ImageRecipe`` | ``imagebuilder:ContainerRecipe``

     

    Either ``IncludeAllResourceTypes`` or ``ResourceTypes`` must be specified.

    

  
  :type ResourceTypes: list
  :param ResourceTypes: 

    The Amazon Web Services resource types to check for image references.

     

    Either ``IncludeAllResourceTypes`` or ``ResourceTypes`` must be specified.

    

  
    - *(dict) --* 

      A resource type to check for image references. Associated options can also be specified if the resource type is an EC2 instance or launch template.

      

    
      - **ResourceType** *(string) --* 

        The resource type.

        

      
      - **ResourceTypeOptions** *(list) --* 

        The options that affect the scope of the response. Valid only when ``ResourceType`` is ``ec2:Instance`` or ``ec2:LaunchTemplate``.

        

      
        - *(dict) --* 

          The options that affect the scope of the response.

          

        
          - **OptionName** *(string) --* 

            The name of the option.

             

            
            * For ``ec2:Instance``: Specify ``state-name`` - The current state of the EC2 instance.
             
            * For ``ec2:LaunchTemplate``: Specify ``version-depth`` - The number of launch template versions to check, starting from the most recent version.
            

            

          
          - **OptionValues** *(list) --* 

            A value for the specified option.

             

            
            * For ``state-name``: 

              
              * Valid values: ``pending`` | ``running`` | ``shutting-down`` | ``terminated`` | ``stopping`` | ``stopped``
               
              * Default: All states
              

            
             
            * For ``version-depth``: 

              
              * Valid values: Integers between ``1`` and ``10000``
               
              * Default: ``10``
              

            
            

            

          
            - *(string) --* 

            
        
        
    
    

  :type NextToken: string
  :param NextToken: 

    The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

    

  
  :type DryRun: boolean
  :param DryRun: 

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is ``DryRunOperation``. Otherwise, it is ``UnauthorizedOperation``.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see `Pagination <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination>`__.

    

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

    
    ::

      {
          'NextToken': 'string',
          'ImageReferences': [
              {
                  'ImageId': 'string',
                  'ResourceType': 'ec2:Instance'|'ec2:LaunchTemplate'|'ssm:Parameter'|'imagebuilder:ImageRecipe'|'imagebuilder:ContainerRecipe',
                  'Arn': 'string'
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **NextToken** *(string) --* 

        The token to include in another request to get the next page of items. This value is ``null`` when there are no more items to return.

        
      

      - **ImageReferences** *(list) --* 

        The resources that are referencing the specified images.

        
        

        - *(dict) --* 

          A resource that is referencing an image.

          
          

          - **ImageId** *(string) --* 

            The ID of the referenced image.

            
          

          - **ResourceType** *(string) --* 

            The type of resource referencing the image.

            
          

          - **Arn** *(string) --* 

            The Amazon Resource Name (ARN) of the resource referencing the image.

            
      
    
  