start_resource_state_update
¶
start_resource_state_update(
resource_arn: ImageBuildVersionArn,
state: ResourceState,
client_token: ClientToken,
*,
config_overrides: Optional[imagebuilderClientConfig] = None,
execution_role: Optional[RoleNameOrArn] = None,
include_resources: Optional[ResourceStateUpdateIncludeResources] = None,
exclusion_rules: Optional[ResourceStateUpdateExclusionRules] = None,
update_at: Optional[DateTimeTimestamp] = None,
) -> StartResourceStateUpdateResponse
Begins an ad-hoc state change for the specified image build version. This is a one-time operation - if you schedule the update, it runs only once. If the request includes underlying resources, or schedules the update far enough in the future, Image Builder runs the update as an asynchronous lifecycle execution and returns its identifier. Otherwise, for target states other than DELETED, the state change applies immediately. If a request that starts a lifecycle execution arrives while the image already has one in progress, Image Builder rejects it.
Parameters:
-
resource_arn(ImageBuildVersionArn) –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, orCANCELLED. Images withFAILEDorCANCELLEDstatus can transition only toDELETED. -
state(ResourceState) –Specifies the lifecycle action to take for this request. For AMI-based images, valid values are
AVAILABLE,DEPRECATED,DISABLED, andDELETED. For container-based images, onlyDELETEDis supported. -
execution_role(Optional[RoleNameOrArn], default:None) –The name or Amazon Resource Name (ARN) of the IAM role that's used to update image state. You must provide this property together with
includeResources. Neither is valid without the other. -
include_resources(Optional[ResourceStateUpdateIncludeResources], default:None) –Specifies which underlying resources to update, in addition to the Image Builder image resource itself. Snapshots and containers are only valid for the
DELETEDstate. To set an image toDELETED, you must include its underlying resources. To delete only the Image Builder image record, use the DeleteImage operation instead. -
exclusion_rules(Optional[ResourceStateUpdateExclusionRules], default:None) –Rules that Image Builder evaluates against each of the image's AMIs. Matching AMIs and their snapshots are skipped. Exclusion rules only take effect when the request includes AMIs. If the target state is
DELETEDand any resource was skipped, the Image Builder image resource itself is also retained. For theDEPRECATEDandDISABLEDtarget states, Image Builder updates the image resource's state regardless of exclusions. -
update_at(Optional[DateTimeTimestamp], default:None) –The timestamp that indicates when resources are updated by a lifecycle action. This property is valid only when the target status is
DEPRECATED, and the value must be a future time. If you don't specify a value, Image Builder begins the state update right away. For a scheduled deprecation, included AMIs get their EC2 deprecation time set immediately, and Image Builder schedules the image resource to transition toDEPRECATEDat that time. -
client_token(ClientToken) –A unique, case-sensitive identifier you provide to ensure that the operation runs no more than one time. If you retry a request with the same client token, Image Builder returns the original response without running the operation again. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.
Raises:
-
CallRateLimitExceededException–You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.
-
ClientException–A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.
-
ForbiddenException–You are not authorized to perform the requested operation.
-
IdempotentParameterMismatchException–You have specified a client token for an operation using parameter values that differ from a previous request that used the same client token.
-
InvalidRequestException–The request is malformed or otherwise invalid. Verify the request and try again.
-
ResourceInUseException–The resource that you are trying to operate on is currently in use. Review the message details and retry later.
-
ResourceNotFoundException–At least one of the resources referenced by your request does not exist.
-
ServiceException–An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.
-
ServiceUnavailableException–The service is unable to process your request at this time.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Schedule an image build version for deprecation The following example schedules the specified image build version and its AMI to move to the DEPRECATED state at the requested future time. It returns the ID of the lifecycle execution that applies the update.
>>> client.start_resource_state_update(resource_arn='arn:aws:imagebuilder:us-west-2:111122223333:image/my-example-recipe/1.0.0/1', state={'status': 'DEPRECATED'}, execution_role='arn:aws:iam::111122223333:role/my-example-state-update-role', include_resources={'amis': True}, update_at='2026-09-11T21:20:00Z', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE24680')
Source code in docs_src/capo_imagebuilder/_services/imagebuilder.py
6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 | |