Configuration Management and IaC

A provisioning worker calls Amazon EC2 RunInstances but sometimes times out after EC2 accepts the request; workers can restart and receive the same job again. Which approach prevents duplicate launches while tolerating transient failures and throttling?

Show the answer

Correct answerA. Persist the job's client token and request parameters; retry with them using exponential backoff and jitter.

AWhy this is right: A persisted token and unchanged parameters make retries idempotent; backoff with jitter handles transient retry pressure.

BWhy not this: Eventually consistent instance discovery can miss a successful launch, allowing a new token to create duplicates.

CWhy not this: A new client token identifies a separate request, so a timed-out successful launch can be duplicated.

DWhy not this: RunInstances has zonal idempotency behavior; changing Availability Zones can permit another launch with the same token.

RunInstances supports idempotency through a client token. Reusing the token and unchanged parameters preserves the request's identity across retries and restarts, while backoff with jitter reduces retry pressure. A fresh token represents a new request and can launch duplicate instances.