EC2 / Client / describe_image_references

describe_image_references

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 in the Amazon EC2 User Guide.

See also: AWS API Documentation

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
)
Parameters:
  • ImageIds (list) –

    [REQUIRED]

    The IDs of the images to check for resource references.

    • (string) –

  • IncludeAllResourceTypes (boolean) –

    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 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.

  • ResourceTypes (list) –

    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) –

  • NextToken (string) – The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

  • DryRun (boolean) – 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.

  • MaxResults (integer) – 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.

Return type:

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.