AccessDenied and request diagnostics
Start with evidence, not a permission change
A request failure is a symptom, not a diagnosis. Imagine Cedar Shop cannot retrieve a private receipt from S3 after a release. Record UTC time, operation, synthetic request ID, account and Region, deployment version, affected users and exact error code. Compare a known-good request from the same authorized role. First distinguish missing or expired credentials, signing failures and wrong endpoints from authorization failures. Never log access keys, session tokens or signed URLs. Check the intended identity against approved configuration; even a real read-only identity call requires authorization in this curriculum. An AccessDenied response does not imply that a broader role is the correct fix.
Investigate the policy boundary
An applicable explicit deny defeats an allow. An implicit deny means the necessary authorization was not established. Examine identity and resource policies, session policies, permission boundaries, SCPs and RCPs where applicable; service-specific rules and cross-account evaluation matter. For S3 also check endpoint policy, Block Public Access, ownership and the KMS key authorization for SSE-KMS. Enhanced denial messages may identify a policy category but do not necessarily reveal every blocker. Do not remove encryption, public access protection or organizational controls to make a test pass. Review only the needed action and exact resource; distinguish a legitimate denial from a broken intended entitlement.
Follow a small diagnostic case
In the synthetic case below, the expected Region is us-east-1, the reported Region matches, the session is valid, and the error says an explicit deny applies. The next step is policy review with the owner, not a retry or administrator grant. Change the observed Region to us-west-2: investigate context first. Change the session to expired: renew only through the approved identity workflow. Request IDs help correlate service responses with sanitized application logs and available CloudTrail events; S3 object-level data events must be configured for relevant audit coverage. An absent log is not proof no request occurred.
{ "expectedRegion": "us-east-1", "region": "us-east-1", "session": "valid", "code": "AccessDenied", "explicitDeny": true}Verify and prevent recurrence
For a confirmed accidental policy regression, propose a minimal reviewed change or rollback to the last approved policy version. Test the intended read and a negative case (another tenant remains denied). Preserve evidence and observe error rate after release. If denial is expected, close the incident without weakening it. If a timeout occurs on a write, reconcile the operation before retrying; use operation-specific idempotency as taught in the SDK chapter. The lab returns a next diagnostic step only, not a policy evaluator or an actual repair.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
AccessDenied and request diagnostics — knowledge check
Reason about evidence-based diagnostics and safe repair.
What should be recorded before changing permissions?
What wins when an applicable explicit deny conflicts with allow?
A valid session reports an unexpected Region. What comes first?
Why may a missing CloudTrail object event be inconclusive?
What verifies a repaired tenant permission?