imagebuilder / Client / get_lifecycle_policy

get_lifecycle_policy#

imagebuilder.Client.get_lifecycle_policy(**kwargs)#

Get details for the specified image lifecycle policy.

See also: AWS API Documentation

Request Syntax

response = client.get_lifecycle_policy(
    lifecyclePolicyArn='string'
)
Parameters:

lifecyclePolicyArn (string) –

[REQUIRED]

Specifies the Amazon Resource Name (ARN) of the image lifecycle policy resource to get.

Return type:

dict

Returns:

Response Syntax

{
    'lifecyclePolicy': {
        'arn': 'string',
        'name': 'string',
        'description': 'string',
        'status': 'DISABLED'|'ENABLED',
        'executionRole': 'string',
        'resourceType': 'AMI_IMAGE'|'CONTAINER_IMAGE',
        'policyDetails': [
            {
                'action': {
                    'type': 'DELETE'|'DEPRECATE'|'DISABLE',
                    'includeResources': {
                        'amis': True|False,
                        'snapshots': True|False,
                        'containers': True|False
                    }
                },
                'filter': {
                    'type': 'AGE'|'COUNT',
                    'value': 123,
                    'unit': 'DAYS'|'WEEKS'|'MONTHS'|'YEARS',
                    'retainAtLeast': 123
                },
                'exclusionRules': {
                    'tagMap': {
                        'string': 'string'
                    },
                    'amis': {
                        'isPublic': True|False,
                        'regions': [
                            'string',
                        ],
                        'sharedAccounts': [
                            'string',
                        ],
                        'lastLaunched': {
                            'value': 123,
                            'unit': 'DAYS'|'WEEKS'|'MONTHS'|'YEARS'
                        },
                        'tagMap': {
                            'string': 'string'
                        }
                    }
                }
            },
        ],
        'resourceSelection': {
            'recipes': [
                {
                    'name': 'string',
                    'semanticVersion': 'string'
                },
            ],
            'tagMap': {
                'string': 'string'
            }
        },
        'dateCreated': datetime(2015, 1, 1),
        'dateUpdated': datetime(2015, 1, 1),
        'dateLastRun': datetime(2015, 1, 1),
        'tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) –

    • lifecyclePolicy (dict) –

      The ARN of the image lifecycle policy resource that was returned.

      • arn (string) –

        The Amazon Resource Name (ARN) of the lifecycle policy resource.

      • name (string) –

        The name of the lifecycle policy.

      • description (string) –

        Optional description for the lifecycle policy.

      • status (string) –

        Indicates whether the lifecycle policy resource is enabled.

      • executionRole (string) –

        The name of the IAM role that Image Builder uses to run the lifecycle policy. This is a custom role that you create.

      • resourceType (string) –

        The type of resources the lifecycle policy targets.

      • policyDetails (list) –

        The configuration details for a lifecycle policy resource.

        • (dict) –

          The configuration details for a lifecycle policy resource.

          • action (dict) –

            Configuration details for the policy action.

            • type (string) –

              Specifies the lifecycle action to take.

            • includeResources (dict) –

              Specifies the resources that the lifecycle policy applies to.

              • amis (boolean) –

                Specifies whether the lifecycle action should apply to distributed AMIs.

              • snapshots (boolean) –

                Specifies whether the lifecycle action should apply to snapshots associated with distributed AMIs.

              • containers (boolean) –

                Specifies whether the lifecycle action should apply to distributed containers.

          • filter (dict) –

            Specifies the resources that the lifecycle policy applies to.

            • type (string) –

              Filter resources based on either age or count.

            • value (integer) –

              The number of units for the time period or for the count. For example, a value of 6 might refer to six months or six AMIs.

              Note

              For count-based filters, this value represents the minimum number of resources to keep on hand. If you have fewer resources than this number, the resource is excluded from lifecycle actions.

            • unit (string) –

              Defines the unit of time that the lifecycle policy uses to determine impacted resources. This is required for age-based rules.

            • retainAtLeast (integer) –

              For age-based filters, this is the number of resources to keep on hand after the lifecycle DELETE action is applied. Impacted resources are only deleted if you have more than this number of resources. If you have fewer resources than this number, the impacted resource is not deleted.

          • exclusionRules (dict) –

            Additional rules to specify resources that should be exempt from policy actions.

            • tagMap (dict) –

              Contains a list of tags that Image Builder uses to skip lifecycle actions for AMIs that have them.

              • (string) –

                • (string) –

            • amis (dict) –

              Lists configuration values that apply to AMIs that Image Builder should exclude from the lifecycle action.

              • isPublic (boolean) –

                Configures whether public AMIs are excluded from the lifecycle action.

              • regions (list) –

                Specifies Amazon Web Services accounts whose resources are excluded from the lifecycle action.

                • (string) –

              • sharedAccounts (list) –

                Specifies configuration details for Image Builder to exclude the most recent resources from lifecycle actions.

                • (string) –

              • lastLaunched (dict) –

                Configures Amazon Web Services Regions that are excluded from the lifecycle action.

                • value (integer) –

                  The integer number of units for the time period. For example 6 (months).

                • unit (string) –

                  Defines the unit of time that the lifecycle policy uses to calculate elapsed time since the last instance launched from the AMI. For example: days, weeks, months, or years.

              • tagMap (dict) –

                Lists tags that should be excluded from lifecycle actions for the AMIs that have them.

                • (string) –

                  • (string) –

      • resourceSelection (dict) –

        Resource selection criteria used to run the lifecycle policy.

        • recipes (list) –

          A list of recipes that are used as selection criteria for the output images that the lifecycle policy applies to.

          • (dict) –

            Specifies an Image Builder recipe that the lifecycle policy uses for resource selection.

            • name (string) –

              The name of an Image Builder recipe that the lifecycle policy uses for resource selection.

            • semanticVersion (string) –

              The version of the Image Builder recipe specified by the name field.

        • tagMap (dict) –

          A list of tags that are used as selection criteria for the resources that the lifecycle policy applies to.

          • (string) –

            • (string) –

      • dateCreated (datetime) –

        The timestamp when Image Builder created the lifecycle policy resource.

      • dateUpdated (datetime) –

        The timestamp when Image Builder updated the lifecycle policy resource.

      • dateLastRun (datetime) –

        The timestamp for the last time Image Builder ran the lifecycle policy.

      • tags (dict) –

        To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the form of tags. Each tag consists of a key and an optional value, both of which you define.

        • (string) –

          • (string) –

Exceptions

  • imagebuilder.Client.exceptions.ServiceException

  • imagebuilder.Client.exceptions.ClientException

  • imagebuilder.Client.exceptions.ServiceUnavailableException

  • imagebuilder.Client.exceptions.InvalidRequestException

  • imagebuilder.Client.exceptions.ForbiddenException

  • imagebuilder.Client.exceptions.CallRateLimitExceededException