ERROR REFERENCE
CloudFormation cannot read a Lambda layer artifact from S3
The layer's ContentUri points at an S3 object the
creating service cannot GetObject. The layer zip
exists — probably — but the read back out of S3 is denied.
WHAT IT MEANS
What this error means
Layer content is fetched from S3 at create time. The denial comes
from one of: a bucket in another account without a bucket policy
granting the read, SSE-KMS encryption whose key the reading identity
cannot use, or a hardcoded ContentUri pointing at an
object that was rotated away while the reference stayed.
FIX
How to fix it
-
Confirm the object exists and you can read it
(read-only):
A 404 here means the reference is stale, not the permissions.aws s3api head-object --bucket layer-bucket --key path/to/layer.zip -
For cross-account layer buckets, the bucket owner
grants
s3:GetObjecton the artifact prefix via bucket policy; check any SSE-KMS key policy alongside it. -
Prefer letting
sam build+ deploy manage the artifact: a localContentUripath uploads to the deployment bucket with permissions that already work, eliminating the hand-managed reference.
AUTOMATE THE TRIAGE
Diagnose this automatically
SAM Doctor recognizes the layer-read denial (high confidence) and keeps it apart from deployment-bucket denials, which have a different fix. Runs locally; no AWS access, no log upload.
python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown
RELATED
Related errors
- S3 error: Access Denied (deployment bucket) — the same shape of failure on the main artifact path.
- Unable to upload artifact referenced by CodeUri — when the referenced path never existed at all.