imagebuilder / Client / start_resource_state_update

start_resource_state_update

imagebuilder.Client.start_resource_state_update(**kwargs)

Begin asynchronous resource state update for lifecycle changes to the specified image resources.

See also: AWS API Documentation

Request Syntax

response = client.start_resource_state_update(
    resourceArn='string',
    state={
        'status': 'AVAILABLE'|'DELETED'|'DEPRECATED'|'DISABLED'
    },
    executionRole='string',
    includeResources={
        'amis': True|False,
        'snapshots': True|False,
        'containers': True|False
    },
    exclusionRules={
        'amis': {
            'isPublic': True|False,
            'regions': [
                'string',
            ],
            'sharedAccounts': [
                'string',
            ],
            'lastLaunched': {
                'value': 123,
                'unit': 'DAYS'|'WEEKS'|'MONTHS'|'YEARS'
            },
            'tagMap': {
                'string': 'string'
            }
        }
    },
    updateAt=datetime(2015, 1, 1),
    clientToken='string'
)
Parameters:
  • resourceArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the image build version to update. The image must be in one of these terminal states: AVAILABLE, DEPRECATED, DISABLED, FAILED, or CANCELLED. Images with FAILED or CANCELLED status can transition only to DELETED.

  • state (dict) –

    [REQUIRED]

    Specifies the lifecycle action to take for this request. For AMI-based images, valid values are AVAILABLE, DEPRECATED, DISABLED, and DELETED. For container-based images, only DELETED is supported.

    • status (string) –

      Shows the current lifecycle policy action that was applied to an impacted resource.

  • executionRole (string) – The name or Amazon Resource Name (ARN) of the IAM role that’s used to update image state.

  • includeResources (dict) –

    Specifies which image resources to include in the state update. When specified, the lifecycle action applies to underlying resources. These resources include AMIs, snapshots, and containers in addition to the Image Builder image resource. Requires executionRole to also be specified. To delete an image and its underlying resources, you must specify includeResources. To delete only the Image Builder image record without affecting underlying resources, use the DeleteImage API instead.

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

  • exclusionRules (dict) –

    Skip action on the image resource and associated resources if specified exclusion rules are met.

    • amis (dict) –

      Defines criteria for AMIs that are excluded from lifecycle actions.

      • isPublic (boolean) –

        Configures whether public AMIs are excluded from the lifecycle action.

      • regions (list) –

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

        • (string) –

      • sharedAccounts (list) –

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

        • (string) –

      • lastLaunched (dict) –

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

        • value (integer) – [REQUIRED]

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

        • unit (string) – [REQUIRED]

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

  • updateAt (datetime) – Specifies the timestamp when the state transition takes effect. Use this parameter only when the target status is DEPRECATED. The value must be a future time.

  • clientToken (string) –

    [REQUIRED]

    Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'lifecycleExecutionId': 'string',
    'resourceArn': 'string'
}

Response Structure

  • (dict) –

    • lifecycleExecutionId (string) –

      Identifies the lifecycle runtime instance that started the resource state update.

    • resourceArn (string) –

      The requested Amazon Resource Name (ARN) of the Image Builder resource for the asynchronous update.

Exceptions

  • imagebuilder.Client.exceptions.ServiceException

  • imagebuilder.Client.exceptions.ClientException

  • imagebuilder.Client.exceptions.ServiceUnavailableException

  • imagebuilder.Client.exceptions.InvalidRequestException

  • imagebuilder.Client.exceptions.ResourceNotFoundException

  • imagebuilder.Client.exceptions.IdempotentParameterMismatchException

  • imagebuilder.Client.exceptions.ForbiddenException

  • imagebuilder.Client.exceptions.CallRateLimitExceededException

  • imagebuilder.Client.exceptions.ResourceInUseException