Skip to content
Latchkey

AWS SAM "S3 Bucket does not exist" - Fix Deploy Bucket in CI

SAM packages your build artifacts to an S3 bucket before deploying, and the bucket it was told to use does not exist (or is in another region). Without it, the upload step fails.

What this error means

sam deploy fails while uploading the packaged artifact, saying the S3 bucket does not exist. It happens when the configured s3_bucket is wrong, the managed bucket was never created, or the region does not match.

sam output
Error: Failed to create/update stack: S3 Bucket does not exist.
Execute the command to create a new bucket:
  aws s3 mb s3://<bucket-name>

Common causes

No deployment bucket provisioned

The configured s3_bucket (in samconfig.toml or --s3-bucket) points at a bucket that was never created, or sam deploy --guided (which sets up a managed bucket) was never run in this account.

Bucket exists but in another region

S3 bucket names are global but buckets are regional. If the deploy region differs from the bucket’s region, SAM cannot use it and reports it missing.

How to fix it

Let SAM manage the bucket

Use --resolve-s3 so SAM creates and reuses a managed deployment bucket automatically.

Terminal
sam deploy --resolve-s3 --no-confirm-changeset --region us-east-1

Provision and pin an explicit bucket

Create a bucket in the deploy region and reference it consistently.

Terminal
aws s3 mb s3://my-sam-artifacts-us-east-1 --region us-east-1
sam deploy --s3-bucket my-sam-artifacts-us-east-1 --region us-east-1

How to prevent it

  • Use --resolve-s3 (or a pinned bucket) so CI never depends on a manual --guided run.
  • Keep the deploy region and bucket region aligned.
  • Commit samconfig.toml with the bucket and region so every run is consistent.

Frequently asked questions

What causes ""S3 Bucket does not exist""?
The configured s3_bucket (in samconfig.toml or --s3-bucket) points at a bucket that was never created, or sam deploy --guided (which sets up a managed bucket) was never run in this account.
How do I fix "S3 Bucket does not exist"?
Use --resolve-s3 so SAM creates and reuses a managed deployment bucket automatically.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card