start_resource_state_update
async
¶
start_resource_state_update(
resource_arn: ImageBuildVersionArn,
state: ResourceState,
client_token: ClientToken,
*,
config_overrides: Optional[AsyncimagebuilderClientConfig] = 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.
>>> await 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/async_imagebuilder.py
6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 | |