EC2 Image Builder

2024/03/06 - EC2 Image Builder - 3 updated api methods

Changes  Add PENDING status to Lifecycle Execution resource status. Add StartTime and EndTime to ListLifecycleExecutionResource API response.

GetLifecycleExecution (updated) Link ¶
Changes (response)
{'lifecycleExecution': {'state': {'status': {'PENDING'}}}}

Get the runtime information that was logged for a specific runtime instance of the lifecycle policy.

See also: AWS API Documentation

Request Syntax

client.get_lifecycle_execution(
    lifecycleExecutionId='string'
)
type lifecycleExecutionId

string

param lifecycleExecutionId

[REQUIRED]

Use the unique identifier for a runtime instance of the lifecycle policy to get runtime details.

rtype

dict

returns

Response Syntax

{
    'lifecycleExecution': {
        'lifecycleExecutionId': 'string',
        'lifecyclePolicyArn': 'string',
        'resourcesImpactedSummary': {
            'hasImpactedResources': True|False
        },
        'state': {
            'status': 'IN_PROGRESS'|'CANCELLED'|'CANCELLING'|'FAILED'|'SUCCESS'|'PENDING',
            'reason': 'string'
        },
        'startTime': datetime(2015, 1, 1),
        'endTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • lifecycleExecution (dict) --

      Runtime details for the specified runtime instance of the lifecycle policy.

      • lifecycleExecutionId (string) --

        Identifies the lifecycle policy runtime instance.

      • lifecyclePolicyArn (string) --

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

      • resourcesImpactedSummary (dict) --

        Contains information about associated resources that are identified for action by the runtime instance of the lifecycle policy.

        • hasImpactedResources (boolean) --

          Indicates whether an image resource that was identified for a lifecycle action has associated resources that are also impacted.

      • state (dict) --

        Runtime state that reports if the policy action ran successfully, failed, or was skipped.

        • status (string) --

          The runtime status of the lifecycle execution.

        • reason (string) --

          The reason for the current status.

      • startTime (datetime) --

        The timestamp when the lifecycle runtime instance started.

      • endTime (datetime) --

        The timestamp when the lifecycle runtime instance completed.

ListLifecycleExecutionResources (updated) Link ¶
Changes (response)
{'lifecycleExecutionState': {'status': {'PENDING'}},
 'resources': {'endTime': 'timestamp', 'startTime': 'timestamp'}}

List resources that the runtime instance of the image lifecycle identified for lifecycle actions.

See also: AWS API Documentation

Request Syntax

client.list_lifecycle_execution_resources(
    lifecycleExecutionId='string',
    parentResourceId='string',
    maxResults=123,
    nextToken='string'
)
type lifecycleExecutionId

string

param lifecycleExecutionId

[REQUIRED]

Use the unique identifier for a runtime instance of the lifecycle policy to get runtime details.

type parentResourceId

string

param parentResourceId

You can leave this empty to get a list of Image Builder resources that were identified for lifecycle actions.

To get a list of associated resources that are impacted for an individual resource (the parent), specify its Amazon Resource Name (ARN). Associated resources are produced from your image and distributed when you run a build, such as AMIs or container images stored in ECR repositories.

type maxResults

integer

param maxResults

The maximum items to return in a request.

type nextToken

string

param nextToken

A token to specify where to start paginating. This is the nextToken from a previously truncated response.

rtype

dict

returns

Response Syntax

{
    'lifecycleExecutionId': 'string',
    'lifecycleExecutionState': {
        'status': 'IN_PROGRESS'|'CANCELLED'|'CANCELLING'|'FAILED'|'SUCCESS'|'PENDING',
        'reason': 'string'
    },
    'resources': [
        {
            'accountId': 'string',
            'resourceId': 'string',
            'state': {
                'status': 'FAILED'|'IN_PROGRESS'|'SKIPPED'|'SUCCESS',
                'reason': 'string'
            },
            'action': {
                'name': 'AVAILABLE'|'DELETE'|'DEPRECATE'|'DISABLE',
                'reason': 'string'
            },
            'region': 'string',
            'snapshots': [
                {
                    'snapshotId': 'string',
                    'state': {
                        'status': 'FAILED'|'IN_PROGRESS'|'SKIPPED'|'SUCCESS',
                        'reason': 'string'
                    }
                },
            ],
            'imageUris': [
                'string',
            ],
            'startTime': datetime(2015, 1, 1),
            'endTime': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • lifecycleExecutionId (string) --

      Runtime details for the specified runtime instance of the lifecycle policy.

    • lifecycleExecutionState (dict) --

      The current state of the lifecycle runtime instance.

      • status (string) --

        The runtime status of the lifecycle execution.

      • reason (string) --

        The reason for the current status.

    • resources (list) --

      A list of resources that were identified for lifecycle actions.

      • (dict) --

        Contains details for a resource that the runtime instance of the lifecycle policy identified for action.

        • accountId (string) --

          The account that owns the impacted resource.

        • resourceId (string) --

          Identifies the impacted resource. The resource ID depends on the type of resource, as follows.

          • Image Builder image resources: Amazon Resource Name (ARN)

          • Distributed AMIs: AMI ID

          • Container images distributed to an ECR repository: image URI or SHA Digest

        • state (dict) --

          The runtime state for the lifecycle execution.

          • status (string) --

            The runtime status of the lifecycle action taken for the impacted resource.

          • reason (string) --

            Messaging that clarifies the reason for the assigned status.

        • action (dict) --

          The action to take for the identified resource.

          • name (string) --

            The name of the resource that was identified for a lifecycle policy action.

          • reason (string) --

            The reason why the lifecycle policy action is taken.

        • region (string) --

          The Amazon Web Services Region where the lifecycle execution resource is stored.

        • snapshots (list) --

          A list of associated resource snapshots for the impacted resource if it’s an AMI.

          • (dict) --

            Contains the state of an impacted snapshot resource that the runtime instance of the lifecycle policy identified for action.

            • snapshotId (string) --

              Identifies the impacted snapshot resource.

            • state (dict) --

              The runtime status of the lifecycle action taken for the snapshot.

              • status (string) --

                The runtime status of the lifecycle action taken for the impacted resource.

              • reason (string) --

                Messaging that clarifies the reason for the assigned status.

        • imageUris (list) --

          For an impacted container image, this identifies a list of URIs for associated container images distributed to ECR repositories.

          • (string) --

        • startTime (datetime) --

          The starting timestamp from the lifecycle action that was applied to the resource.

        • endTime (datetime) --

          The ending timestamp from the lifecycle action that was applied to the resource.

    • nextToken (string) --

      The next token used for paginated responses. When this field isn't empty, there are additional elements that the service hasn't included in this request. Use this token with the next request to retrieve additional objects.

ListLifecycleExecutions (updated) Link ¶
Changes (response)
{'lifecycleExecutions': {'state': {'status': {'PENDING'}}}}

Get the lifecycle runtime history for the specified resource.

See also: AWS API Documentation

Request Syntax

client.list_lifecycle_executions(
    maxResults=123,
    nextToken='string',
    resourceArn='string'
)
type maxResults

integer

param maxResults

The maximum items to return in a request.

type nextToken

string

param nextToken

A token to specify where to start paginating. This is the nextToken from a previously truncated response.

type resourceArn

string

param resourceArn

[REQUIRED]

The Amazon Resource Name (ARN) of the resource for which to get a list of lifecycle runtime instances.

rtype

dict

returns

Response Syntax

{
    'lifecycleExecutions': [
        {
            'lifecycleExecutionId': 'string',
            'lifecyclePolicyArn': 'string',
            'resourcesImpactedSummary': {
                'hasImpactedResources': True|False
            },
            'state': {
                'status': 'IN_PROGRESS'|'CANCELLED'|'CANCELLING'|'FAILED'|'SUCCESS'|'PENDING',
                'reason': 'string'
            },
            'startTime': datetime(2015, 1, 1),
            'endTime': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • lifecycleExecutions (list) --

      A list of lifecycle runtime instances for the specified resource.

      • (dict) --

        Contains metadata from a runtime instance of a lifecycle policy.

        • lifecycleExecutionId (string) --

          Identifies the lifecycle policy runtime instance.

        • lifecyclePolicyArn (string) --

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

        • resourcesImpactedSummary (dict) --

          Contains information about associated resources that are identified for action by the runtime instance of the lifecycle policy.

          • hasImpactedResources (boolean) --

            Indicates whether an image resource that was identified for a lifecycle action has associated resources that are also impacted.

        • state (dict) --

          Runtime state that reports if the policy action ran successfully, failed, or was skipped.

          • status (string) --

            The runtime status of the lifecycle execution.

          • reason (string) --

            The reason for the current status.

        • startTime (datetime) --

          The timestamp when the lifecycle runtime instance started.

        • endTime (datetime) --

          The timestamp when the lifecycle runtime instance completed.

    • nextToken (string) --

      The next token used for paginated responses. When this field isn't empty, there are additional elements that the service hasn't included in this request. Use this token with the next request to retrieve additional objects.