Production Configuration Best Practices
A pre-launch checklist for AWS SDK authentication and configuration hygiene.
Busque em todas as páginas da documentação
A pre-launch checklist for AWS SDK authentication and configuration hygiene.
Walk it before a service goes live, and revisit it whenever you add a new environment or credential source.
- [ ] as a gate - do not launch with an unchecked security item.fromTemporaryCredentials/fromWebToken rather than a one-shot manual assume.http-tokens required). The v2 PUT-token handshake blocks the SSRF attacks that stole v1 credentials.AWS_EC2_METADATA_V1_DISABLED=true. Make the SDK itself refuse the legacy v1 path.169.254.169.254 should fail fast, not hang startup.AWS_REGION/AWS_PROFILE surprises.credential_process/fromProcess, fromWebToken, and fromTemporaryCredentials before writing custom code.get_caller_identity turns wrong-account bugs into an obvious log line.NoCredentialsError/CredentialsProviderError at startup with an actionable message.RequestId/$metadata.requestId for support cases and tracing.They are the highest-leverage and least reversible. A leaked long-lived key can be abused long after a wrong timeout would have been noticed and fixed.
For local dev, env vars are fine. For production compute, prefer an attached role so no static secret lives in the workload at all.
Its required PUT-token handshake blocks the server-side request forgery attacks that let attackers read v1 credentials with a simple GET.
Default 1 blocks containers on the instance. Set at least 2 when containerized apps on EC2 need metadata credentials.
There is no built-in default region, and env vars can override the profile. Pinning region in code removes ambiguity for regional services.
Not always. Standard is a solid default; adaptive adds client-side rate limiting that helps under sustained throttling but is unnecessary for low-volume calls.
When no external party assumes roles in your account. It is essential specifically for third-party, cross-organization role assumption.
Precedence and chain bugs are invisible until observed. A one-line get_caller_identity at boot surfaces wrong-account misconfiguration immediately.
Shipping long-lived keys - in code, an image, or a stray env var - instead of using roles and temporary, auto-refreshed credentials.
If keys are truly static you can omit it, but returning an expiration is safer and required the moment rotation is introduced.
Yes. Construct clients outside the handler so warm invocations reuse the connection pool and resolved credentials.
Before launch, and again whenever you add an environment, a credential source, or a new cross-account or third-party integration.
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 atualização: 23 de jul. de 2026