Debugging & Incident Response Best Practices
These are the defaults every AWS-backed service should set explicitly, drawn from the recurring defect patterns covered earlier in this section.
Busca en todas las páginas de la documentación
These are the defaults every AWS-backed service should set explicitly, drawn from the recurring defect patterns covered earlier in this section.
Walk the list once now, then use it as a review checklist before shipping any code that calls AWS, and again as a first response during any live incident.
err.response["Error"]["Code"] (boto3) or error.name (SDK v3); message text is human-readable and can change.ResponseMetadata.RequestId (boto3) or $metadata.requestId (SDK v3) on every failure for tracing and AWS Support.4xx usually means fix the request; 5xx is usually transient and already retried by the SDK.Pull code, request id, and status together, in one place.
# --- Python (boto3) ---
from botocore.exceptions import ClientError
try:
client.some_operation()
except ClientError as err:
print({
"code": err.response["Error"]["Code"],
"request_id": err.response["ResponseMetadata"]["RequestId"],
"status": err.response["ResponseMetadata"]["HTTPStatusCode"],
})
raise// --- TypeScript (AWS SDK v3) ---
try {
await client.send(command);
} catch (err) {
const e = err as { name?: string; $metadata?: { requestId?: string; httpStatusCode?: number } };
console.log({ code: e.name, requestId: e.$metadata?.requestId, status: e.$metadata?.httpStatusCode });
throw err;
}fromTemporaryCredentials (SDK v3) or a role-assuming profile (boto3) instead of extracting AccessKeyId/SecretAccessKey/SessionToken into variables.ExpiredTokenException/ExpiredToken. A dedicated alarm surfaces this bucket faster than a generic error-rate signal.botocore.config.Config(retries={...}) (boto3) or maxAttempts/retryStrategy (SDK v3) instead of writing a retry loop by hand.Configure retries on the client once - do not write the loop yourself.
# --- Python (boto3) ---
from botocore.config import Config
cfg = Config(retries={"max_attempts": 5, "mode": "adaptive"})
ddb = boto3.client("dynamodb", config=cfg)// --- TypeScript (AWS SDK v3) ---
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { AdaptiveRetryStrategy } from "@aws-sdk/util-retry";
const ddb = new DynamoDBClient({ retryStrategy: new AdaptiveRetryStrategy(async () => 5) });ConsistentRead=True/ConsistentRead: true on DynamoDB reads that need read-your-own-write correctness, not on every read by default (it costs double capacity and isn't available on GSIs).AccessDenied persists past a handful of attempts, treat it as a real policy problem, not propagation.ThrottledRequests, specific auth error codes, and traffic correlation - not a single generic error-rate alarm.Code that bypasses what the SDK already does for you - caching a credential snapshot instead of using a provider, or hand-rolling a retry loop instead of using the built-in backoff-and-jitter strategy.
No, not for read-after-write. That changed in December 2020. DynamoDB's default reads are still eventually consistent, and IAM changes still have a propagation delay - the three services are not the same, and it's worth knowing which model applies where.
No. Alarm on the specific signal for the failure bucket that matters most for that service - a throttle metric for a rate-limited service, an auth error code for anything using assumed roles, and so on.
When the immediate impact is mitigated, the root cause is understood and written up, and the resulting action items are assigned with owners - not simply when the alarm stops firing.
No. Reserve it for calls to dependencies with a real history of transient degradation, where fast-failing during an outage is preferable to piling retry volume onto an already-struggling service.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+).
Revisado por Chris St. John·Última actualización: 23 jul 2026