distribute_image
async
¶
distribute_image(
source_image: NonEmptyString,
distribution_configuration_arn: DistributionConfigurationArn,
execution_role: RoleNameOrArn,
client_token: ClientToken,
*,
config_overrides: Optional[AsyncimagebuilderClientConfig] = None,
tags: Optional[TagMap] = None,
logging_configuration: Optional[ImageLoggingConfiguration] = None,
) -> DistributeImageResponse
Distributes an existing AMI to target Regions and accounts without running the full image build process. This operation only runs the distribution phase on an image that has already been built.
Parameters:
-
source_image(NonEmptyString) –The source image to distribute. You can specify the source in any of the following formats:
-
An AMI ID.
-
An Amazon Web Services Systems Manager Parameter Store reference, prefixed by
ssm:, followed by the parameter name or ARN. -
An Image Builder image Amazon Resource Name (ARN). An image version ARN resolves to the latest available build version.
Whichever format you use, the source must resolve to an AMI in the current Amazon Web Services Region.
-
-
distribution_configuration_arn(DistributionConfigurationArn) –The Amazon Resource Name (ARN) of the distribution configuration. The configuration defines target Regions, accounts, and AMI settings. The distribution configuration must be in the same Region as this operation.
-
execution_role(RoleNameOrArn) –The name or Amazon Resource Name (ARN) of the IAM role that Image Builder assumes to distribute the image.
-
tags(Optional[TagMap], default:None) –The tags to apply to the new Image Builder image resource that this operation creates. To tag the output AMIs, use
amiTagsin the distribution configuration. -
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.
-
logging_configuration(Optional[ImageLoggingConfiguration], default:None) –The logging configuration for the distribution.
Raises:
-
AccessDeniedException–You do not have permissions to perform the requested operation.
-
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.
-
ServiceQuotaExceededException–You have exceeded the number of permitted resources or operations for this service. For service quotas, see EC2 Image Builder endpoints and quotas.
-
ServiceUnavailableException–The service is unable to process your request at this time.
-
TooManyRequestsException–You have attempted too many requests for the specific operation.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Distribute an existing AMI The following example distributes an AMI that you own to the targets defined in the specified distribution configuration. It returns the ARN of a new Image Builder image resource that you can use with GetImage to monitor distribution progress.
>>> await client.distribute_image(source_image='ami-1234567890abcdef0', distribution_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution-configuration', execution_role='arn:aws:iam::111122223333:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE86420')
Source code in docs_src/capo_imagebuilder/_services/async_imagebuilder.py
2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | |